|
Boost Users : |
From: C. Michailidis (dinom_at_[hidden])
Date: 2005-04-14 18:02:07
> It seems the usage of the vector cases problems with the multithreaded
programs on the multiprocessor machines.
> I have changed it to queue and the bug has been resolved. I cannot reproduce
it now.
Huh, that's interesting! I suppose it may no longer be a major issue for you
then (even though vectors and queues have different algorithms under the
hood).
Because you mentioned that the problem seems to be limited to true SMP
systems, I tried your code again (this time on a dual cpu system) and I still
couldn't reproduce it. I must admit that the process didn't seem to bounce
between cpus though, so perhaps something is lost in the shuffle in that
regard. The dual cpu system was configured similarly to the first machine
that I tried it on (FreeBSD 5.3 + boost 1.32.0_2). The first machine
(although not a 'true' smp system) is using hyperthreading w/ an SMP kernel
so as far as the OS is concerned it too is a multiprocessor machine.
If you still want to isolate the problem that you *were* having (using vector)
then you may be interested in the details of thread-safe CRTs.
The "-lc_r" indicates that (on FreeBSD) the re-entrant C library (i.e.
thread-safe) should be linked against. On Windows I believe the analog is
called something like 'msvcrtmt.dll' (C RunTime - MultiThreaded). I would
hope that the .NET compiler uses this 'msvcrtmt.dll' when 'multithreaded
support is on', but I couldn't tell you for sure. If you're statically
linking, I think the name is just 'msvcrtmt.lib'. The thread-unsafe version
doesn't have 'mt' appended to the library filename.
The glamour of MSFT development has been largely replaced with a desire to
actually get stuff working so... most of my development has been on FreeBSD
lately. Therefore some of this MSFT specific information may not be exactly
correct. Oh how the cobwebs accumulate!
Anyway, you could probably double check for the 'msvcrtmt' library by looking
at the detailed linker settings, that is if my suspicion concerns you and
you're still interested in isolating the problem.
In any case, I'm glad you found a work-around!
C. Michailidis
Balston Research LLC
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net