[OpenIndiana-discuss] SS cc multithread compilation switch (e.g., Parrot)

James Carlson carlsonj at workingcode.com
Wed Oct 31 14:18:21 UTC 2012


On 10/31/2012 9:49 AM, Udo Grabowski (IMK) wrote:
> Thanks a lot for this info, it's a pity that this isn't documented
> well, I also read the Multithread Guide
> <http://docs.oracle.com/cd/E19253-01/816-5137/compile-74765/index.html>
> and it's all not entirely complete nor completely consistent...
> confusing, at best.

The bottom line here is that there are no dummy locks or other bugaboos
hiding out in the modern system.  Being threading-aware all of the time
has simplified a lot of this grot.

If you want, feel free to wave the "-mt" dead chicken around.  Perhaps
there's something deep and undocumented in the C++ compiler that it
tweaks, if you're into that C++ scene.  But the real locks and thread
resources that were once located in libpthread and libthread are now
actually in libc and are active all the time.  Linking with them or
failing to link with them doesn't change the behavior of locks or affect
the presence of threads.

If you look at the OpenIndiana source, you'll see that most of the code
is compiled without "-mt" and simply sets -D_REENTRANT when desired to
access the "_r" functions.  (There are a few places using "-mt", but
there are many more where the code is MT-hot but doesn't use it.  I
suspect that the remaining "-mt" uses are just stale.)

-- 
James Carlson         42.703N 71.076W         <carlsonj at workingcode.com>



More information about the OpenIndiana-discuss mailing list