Fix problem with incremental with portfolio. Fixes bug 420.
authorKshitij Bansal <kshitij@cs.nyu.edu>
Fri, 19 Oct 2012 19:10:42 +0000 (19:10 +0000)
committerKshitij Bansal <kshitij@cs.nyu.edu>
Fri, 19 Oct 2012 19:10:42 +0000 (19:10 +0000)
(this commit was certified error- and warning-free by the test-and-commit script.)

src/main/portfolio.cpp

index 91037df17538e1e5bd5fbf1575a37a829663039a..4c542f54867c601a8aa86f74bdefee054d13103f 100644 (file)
@@ -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],