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.