tech-userlevel archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: Moving pthread_(cond|mutex) to libc
On Fri, Jan 25, 2013 at 05:21:51PM +0000, David Holland wrote:
> On Fri, Jan 25, 2013 at 04:31:54PM +0000, Emmanuel Dreyfus wrote:
> > IMO the bug here is NetBSD enforcing a petty rule that breaks software,
> > fix nothing, and has no workaround (yet).
>
> It is not a petty rule; there's a good reason for it.
>
> That said, it's a fair point. If I'm writing a library, and I want the
> library to be safely usable by both threaded and unthreaded programs,
> is there anything I can do? Right now it seems the only fully viable
> approach is to build two versions and hope I can figure out how to get
> clients to link the right one, which is pretty sketchy.
You can put whatever library functionality uses libpthread functionality
into another library, which depends both on the main library and on
libpthread. So:
libuse -> depends only on non-thread libraries
libose -> libpthread
libose -> libuse
Applications which want the specific functionality in the API that
requires threads link with -lose. Applications that want the subset
of the API that does not require threads link with -luse.
Thor
lib
Home |
Main Index |
Thread Index |
Old Index