RE: [Boost-users] RE: Boost thread problem
Wow, wow, wow,
Guys, this was my private program. I simply did not have access to the
The CFXTrade is a dummy class. Here is the simple code, Pshemek -----Original Message----- From: boost-users-bounces@lists.boost.org [mailto:boost-users-bounces@lists.boost.org] On Behalf Of Ben Hutchings Sent: 18 April 2005 17:04 To: boost-users@lists.boost.org Subject: Re: [Boost-users] RE: Boost thread problem Sliwa, Przemyslaw (London) wrote: private email account from work.
As you have probably seen the issue was not with the CFXTrade class but rather with the vectro<T> one.
I very much doubt that there's a bug in the std::vector implementation you're using. More likely CFXTrade doesn't meet the requirements for vector element types (CopyConstructible and Assignable). But and queue uses deque by default, and deque imposes the same requirements, so even if your program works on your current compiler it could break if you use any other compiler, or a different version, or even different options. Of course, we can't really tell if you don't post the missing code. Ben. _______________________________________________ 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/ --------------------------------------------------------
Sliwa, Przemyslaw (London) wrote:
The CFXTrade is a dummy class. Here is the simple code,
Pshemek
Well, there's nothing wrong with CFXTrade, but at least I know I have a complete program to look at now. read_trades() copies TradeVector without locking the mutex that should protect it. It should be passing boost::ref(TradeVector) to boost::bind instead of TradeVector, or maybe not passing an argument at all. This is probably what's responsible for the crash. Other problems I spotted: - read_from_disk doesn't use its argument; it uses TradeVector directly - generate_file is not exception-safe - if thread creation fails, out will not be closed and other child threads will not be joined - generate_file also copies the vector it passes to threads (but this does not affect correctness and so long as generate_file may exit without joining the child thread it is unsafe to pass a reference) - getTradeFromString has no error-handling Ben.
participants (2)
-
Ben Hutchings
-
Sliwa, Przemyslaw (London)