Matthew Peltzer wrote:
Well, if anyone would care to compile and run the following program on Mac OS X using pthreads, we can at least tell whether there is a consistent failure:
Here's what it looks it looks like with boost1_31 from fink on OS X 10.3.8:
g++ -v
Reading specs from /usr/libexec/gcc/darwin/ppc/3.3/specs Thread model: posix gcc version 3.3 20030304 (Apple Computer, Inc. build 1671)
g++ -I/sw/include/boost-1_31 -L/sw/lib -lboost_thread-1_31 -o thread thread.cpp
It's not clear to me from this whether you linked to a debug version of the thread library. In a non-debug version the assertions are disabled, so that wouldn't provide a useful test.
In file included from /sw/include/boost-1_31/boost/type_traits/is_arithmetic.hpp:13, from /sw/include/boost-1_31/boost/type_traits/arithmetic_traits.hpp:14, from /sw/include/boost-1_31/boost/function/function_base.hpp:19, from /sw/include/boost-1_31/boost/function/detail/prologue.hpp:16, from /sw/include/boost-1_31/boost/function.hpp:22, from /sw/include/boost-1_31/boost/thread/thread.hpp:20, from thread.cpp:2: /sw/include/boost-1_31/boost/type_traits/is_float.hpp:21: warning: use of `long double' type; its size may change in a future release /sw/include/boost-1_31/boost/type_traits/is_float.hpp:21: warning: (Long double usage is reported only once for each file. /sw/include/boost-1_31/boost/type_traits/is_float.hpp:21: warning: To disable this warning, use -Wno-long-double.)
./thread
Joining exited thread Joining running thread
...not sure if i'm "using pthreads" explicitly, but it all looks good to me.
"Thread model: posix" seems to imply that g++ will generate code suitable for pthreads, though most ports require a command-line option to ensure that it generates thread-safe code and uses thread-safe libraries. Perhaps the Darwin port always operates in thread-safe mode. Ben.