Boost synchronization
问题 I have NUM_THREADS threads, with the following codes in my thread: /* Calculate some_value; */ //Critical section to accummulate all thresholds { boost::mutex::scoped_lock lock(write_mutex); T += some_value; num_threads++; if (num_threads == NUM_THREADS){ T = T/NUM_THREADS; READY = true; cond.notify_all(); num_threads = 0; } } //Wait for average threshold to be ready if (!READY) { boost::unique_lock<boost::mutex> lock(wait_mutex); while (!READY){ cond.wait(lock); } } //End critical section /*