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)
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],