diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/portfolio.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/main/portfolio.cpp b/src/main/portfolio.cpp index 91037df17..4c542f548 100644 --- a/src/main/portfolio.cpp +++ b/src/main/portfolio.cpp @@ -29,8 +29,8 @@ boost::mutex mutex_done; boost::mutex mutex_main_wait; boost::condition condition_var_main_wait; -bool global_flag_done = false; -int global_winner = -1; +bool global_flag_done; +int global_winner; template<typename S> void runThread(int thread_id, boost::function<S()> threadFn, S& returnValue) @@ -56,6 +56,9 @@ std::pair<int, S> runPortfolio(int numThreads, boost::thread threads[numThreads]; S threads_returnValue[numThreads]; + global_flag_done = false; + global_winner = -1; + for(int t = 0; t < numThreads; ++t) { threads[t] = boost::thread(boost::bind(runThread<S>, t, threadFns[t], |