This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Writing a thread-safe library without pulling in pthreads


Florian Weimer <fw@deneb.enyo.de> writes:

> I'd like to write a library which only uses locking if the application
> is linked against pthreads.  Is this possible?

Yes, and in fact libsupc++ in gcc does it.  You can declare the
pthread functions as weak references.  Then you only call them if the
address of the function is not NULL.

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]