Home | History | Annotate | Download | only in platform

Lines Matching refs:threads

61   ThreadWithMutexAndConditionVariable threads[kThreadCount];
64 LockGuard<Mutex> lock_guard(&threads[n].mutex_);
65 EXPECT_FALSE(threads[n].running_);
66 EXPECT_FALSE(threads[n].finished_);
67 threads[n].Start();
69 while (!threads[n].running_) {
70 threads[n].cv_.Wait(&threads[n].mutex_);
75 LockGuard<Mutex> lock_guard(&threads[n].mutex_);
76 EXPECT_TRUE(threads[n].running_);
77 EXPECT_FALSE(threads[n].finished_);
81 LockGuard<Mutex> lock_guard(&threads[n].mutex_);
82 EXPECT_TRUE(threads[n].running_);
83 EXPECT_FALSE(threads[n].finished_);
85 threads[n].running_ = false;
86 threads[n].cv_.NotifyOne();
91 LockGuard<Mutex> lock_guard(&threads[n].mutex_);
92 while (!threads[n].finished_) {
93 threads[n].cv_.Wait(&threads[n].mutex_);
95 EXPECT_FALSE(threads[n].running_);
96 EXPECT_TRUE(threads[n].finished_);
100 threads[n].Join();
101 LockGuard<Mutex> lock_guard(&threads[n].mutex_);
102 EXPECT_FALSE(threads[n].running_);
103 EXPECT_TRUE(threads[n].finished_);
141 ThreadWithSharedMutexAndConditionVariable threads[kThreadCount];
146 threads[n].mutex_ = &mutex;
147 threads[n].cv_ = &cv;
150 // Start all threads.
154 EXPECT_FALSE(threads[n].running_);
155 EXPECT_FALSE(threads[n].finished_);
156 threads[n].Start();
160 // Wait for all threads to start.
164 while (!threads[n].running_) {
170 // Make sure that all threads are running.
174 EXPECT_TRUE(threads[n].running_);
175 EXPECT_FALSE(threads[n].finished_);
179 // Tell all threads to quit.
183 EXPECT_TRUE(threads[n].running_);
184 EXPECT_FALSE(threads[n].finished_);
186 threads[n].running_ = false;
191 // Wait for all threads to quit.
195 while (!threads[n].finished_) {
201 // Make sure all threads are finished.
205 EXPECT_FALSE(threads[n].running_);
206 EXPECT_TRUE(threads[n].finished_);
210 // Join all threads.
212 threads[n].Join();
275 // Setup the threads.
276 Thread** threads = new Thread* [thread_count];
278 threads[n] = new LoopIncrementThread(n, &counter, limit, thread_count,
282 // Start all threads.
284 threads[n]->Start();
287 // Join and cleanup all threads.
289 threads[n]->Join();
290 delete threads[n];
292 delete[] threads;