Lines Matching refs:threads
80 ThreadWithMutexAndConditionVariable threads[kThreadCount];
83 LockGuard<Mutex> lock_guard(&threads[n].mutex_);
84 CHECK(!threads[n].running_);
85 CHECK(!threads[n].finished_);
86 threads[n].Start();
88 while (!threads[n].running_) {
89 threads[n].cv_.Wait(&threads[n].mutex_);
94 LockGuard<Mutex> lock_guard(&threads[n].mutex_);
95 CHECK(threads[n].running_);
96 CHECK(!threads[n].finished_);
100 LockGuard<Mutex> lock_guard(&threads[n].mutex_);
101 CHECK(threads[n].running_);
102 CHECK(!threads[n].finished_);
104 threads[n].running_ = false;
105 threads[n].cv_.NotifyOne();
110 LockGuard<Mutex> lock_guard(&threads[n].mutex_);
111 while (!threads[n].finished_) {
112 threads[n].cv_.Wait(&threads[n].mutex_);
114 CHECK(!threads[n].running_);
115 CHECK(threads[n].finished_);
119 threads[n].Join();
120 LockGuard<Mutex> lock_guard(&threads[n].mutex_);
121 CHECK(!threads[n].running_);
122 CHECK(threads[n].finished_);
154 ThreadWithSharedMutexAndConditionVariable threads[kThreadCount];
159 threads[n].mutex_ = &mutex;
160 threads[n].cv_ = &cv;
163 // Start all threads.
167 CHECK(!threads[n].running_);
168 CHECK(!threads[n].finished_);
169 threads[n].Start();
173 // Wait for all threads to start.
177 while (!threads[n].running_) {
183 // Make sure that all threads are running.
187 CHECK(threads[n].running_);
188 CHECK(!threads[n].finished_);
192 // Tell all threads to quit.
196 CHECK(threads[n].running_);
197 CHECK(!threads[n].finished_);
199 threads[n].running_ = false;
204 // Wait for all threads to quit.
208 while (!threads[n].finished_) {
214 // Make sure all threads are finished.
218 CHECK(!threads[n].running_);
219 CHECK(threads[n].finished_);
223 // Join all threads.
225 threads[n].Join();
283 // Setup the threads.
284 Thread** threads = new Thread*[thread_count];
286 threads[n] = new LoopIncrementThread(
290 // Start all threads.
292 threads[n]->Start();
295 // Join and cleanup all threads.
297 threads[n]->Join();
298 delete threads[n];
300 delete[] threads;