Subj : Re: Where to download a pthread library To : comp.programming.threads From : Casper H.S. Dik Date : Fri Apr 01 2005 05:59 pm David Butenhof writes: >Drazen Kacar wrote: >> David Butenhof wrote: >> >>> David Schwartz wrote: >> >>>>Many platforms require more than just linking in an additional >>>>library, they need compiler flags (like -D_REENTRANT) as well. The >>>>standard is '-pthread' to do >> >>> -pthread is arguably a reasonably widespread CONVENTION, but definitely >>> not worthy of the term "standard" either in a de jure or de facto sense. >>> It'll work for many versions of gcc across platforms, (but not all), and >>> several vendor compilers. The second most popular is probably "-mt" >>> (e.g., on Solaris). >> >> AFAIK, -mt is just a shortcut for -D_REENTRANT and -lthread with Sun's >> compiler. You still need to add -lpthread if you want to use POSIX >> threads. Maybe it would work with -mt only, but that's an implementation >> artifact, I think. >The real point, beyond the few common examples, is that ALL of this is >"implementation artifact", unless you're using a c89 or c99 command that >conforms to UNIX 2001 or later. And I doubt that many people are -- even >if there really ARE any fully conforming commands (which I also doubt). And the semantics may also change from one compiler or OS release to the next. E.g., in Solaris 10 it's no longer required to link with -lpthread or -lthread, only the #define is really needed. Solaris 10 also has the nice property that you can now start threads in dlopen'ed objects in processes which are otherwise thread agnostic; this was not the case before and not something supported by other OSes I know off. Casper -- Expressed in this posting are my opinions. They are in no way related to opinions held by my employer, Sun Microsystems. Statements on Sun products included here are not gospel and may be fiction rather than truth. .