
Brian Plummer escribió:
The following simple program seg faults. (I have boiled it down to the bare essentials to product the fault:
I changed your test program to make compiler happy. This is my modified version: =========bug.cc======== #include <boost/thread.hpp> void MMULT2(void); void MMULT2CalcMaster(void); int main(void) { MMULT2(); } class MMULT2ThreadClass { void calculate(void) {} public : MMULT2ThreadClass() {} void operator ()() { calculate(); } }; void MMULT2CalcMaster(void) { int numThreads = 2; boost::thread_group threads; for (int i = 0; i < numThreads; ++i) threads.create_thread(MMULT2ThreadClass()); threads.join_all(); } void MMULT2(void) { MMULT2CalcMaster(); } ================ (I have changed "void *" to "void" in several places). It works ok for me. I've compiled with: gcc -c -Wall -g \ -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE \ -I/opt/boost_1_33_1/include bug.cc -o _linux.O/bug.o And I've linked with: gcc -Wall -g -Ihdrs \ -D_REENTRANT -D_THREAD_SAFE -D_GNU_SOURCE \ -I/opt/boost_1_33_1/include _linux.O/bug.o \ -o ../_linux.O/bug -L/opt/boost_1_33_1/lib \ -Wl,-rpath,/opt/boost_1_33_1/lib \ -lboost_thread-mt-d -lpthread -lstdc++ My gcc is 4.0.2. Hope this helps. Raúl.