Well, I have tried it on three systems: 1 multiprocessor Win XP -> fails, some problems with the heap, 2. single processor Win 2000 -> works fine, no problems at all, all the treads exit properly, 3. single processor Linux Suse 9.1, gcc 3.3 -> fails, segmentation fault. I am also using the boost 1.32 library. Similar compilation on Linux except -lc_r. What is it for? How to check if I am linking against thread safe libraries? On Windows the NET 2003 compiler was used, the multithreaded support was on, so I have no idea how to link against tread safe libs. Can you advise? Thanks in advance Pshemek -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of C. Michailidis Sent: 14 April 2005 07:26 To: boost-users@lists.boost.org Subject: [Boost-users] RE: Boost thread problem
All,
I have got a problem with the boost::thread package. My idea was to facilitate the multiprocessor ability of my computer and write a program which creates 10 threads which firstly write to the disk certain amount of information and then they read it back and push back certain objects. I am getting some memory access problems when pushing back the objects to the global vector. Can anyone of you understand why there is a problem? I really do not get it since the mutex is locked and the access to the vector is exclusively guaranteed to the active thread.
Can you help?
I tried your code on my system and it seems to work as expected. No exceptions were thrown, there was a file called 'file.txt' in the pwd, and TradeVector.size was 80000 after the run. Of course I needed to remove the include of proprietary code - it was replaced with a dummy/stub class like this one: class CFXTrade { public: CFXTrade() { }; CFXTrade( int id, string name, double amt ) { m_TradeID = id; m_Name = name; m_Amount = amt; }; int m_TradeID; string m_Name; double m_Amount; }; My system looks like this: FreeBSD medea.digitalescorts.net 5.4-PRERELEASE FreeBSD 5.4-PRERELEASE #0: Thu Mar 31 02:47:38 EST 2005 root@medea.digitalescorts.net:/usr/obj/usr/src/sys/MEDEA i386 and I have boost-1.32.0_2 libraries installed. I built the program from the command-line using the following command: "gcc hello.cpp -ggdb -I/usr/local/include -L/usr/local/lib -lboost_thread -lc_r" The problem may be platform specific. Are you linking against a thread-safe CRT? Can you provide details regarding your operating system? Which version of the boost library do you have installed? My suspicion is that you may not be using a thread-safe CRT. Of course the boost_thread library may be broken for your specific platform (but I doubt it). Sincerely, Constantino Michailidis Balston Research LLC _______________________________________________ Boost-users mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users -------------------------------------------------------- If you are not an intended recipient of this e-mail, please notify the sender, delete it and do not read, act upon, print, disclose, copy, retain or redistribute it. Click here for important additional terms relating to this e-mail. http://www.ml.com/email_terms/ --------------------------------------------------------