Lines Matching full:thread
22 // Trivial tests that thread runs and doesn't crash on create, join, or detach -
44 TrivialThread thread; in TEST() local
47 ASSERT_FALSE(thread.run_event().IsSignaled()); in TEST()
48 ASSERT_TRUE(PlatformThread::Create(0, &thread, &handle)); in TEST()
50 ASSERT_TRUE(thread.run_event().IsSignaled()); in TEST()
54 TrivialThread thread[10]; in TEST() local
55 PlatformThreadHandle handle[arraysize(thread)]; in TEST()
57 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
58 ASSERT_FALSE(thread[n].run_event().IsSignaled()); in TEST()
59 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
60 ASSERT_TRUE(PlatformThread::Create(0, &thread[n], &handle[n])); in TEST()
61 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
63 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
64 ASSERT_TRUE(thread[n].run_event().IsSignaled()); in TEST()
68 // end and termination of the thread, but threads could persist shortly after
71 TrivialThread thread; in TEST() local
74 ASSERT_FALSE(thread.run_event().IsSignaled()); in TEST()
75 ASSERT_TRUE(PlatformThread::Create(0, &thread, &handle)); in TEST()
77 thread.run_event().Wait(); in TEST()
81 TrivialThread thread[10]; in TEST() local
82 PlatformThreadHandle handle[arraysize(thread)]; in TEST()
84 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
85 ASSERT_FALSE(thread[n].run_event().IsSignaled()); in TEST()
86 for (size_t n = 0; n < arraysize(thread); n++) { in TEST()
87 ASSERT_TRUE(PlatformThread::Create(0, &thread[n], &handle[n])); in TEST()
90 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
91 thread[n].run_event().Wait(); in TEST()
94 // Tests of basic thread functions ---------------------------------------------
109 << "Need to mark thread for termination and join the underlying thread " in ~FunctionTestThread()
111 << "WaitableEvent blocking the underlying thread's main."; in ~FunctionTestThread()
114 // Grabs |thread_id_|, runs an optional test on that thread, signals
121 // Make sure that the thread ID is the same across calls. in ThreadMain()
134 EXPECT_TRUE(termination_ready_.IsSignaled()) << "Thread ID still unknown"; in thread_id()
142 // Blocks until this thread is started and ready to be terminated.
145 // Marks this thread for termination (callers must then join this thread to be
150 // Runs an optional test on the newly created thread.
167 FunctionTestThread thread; in TEST() local
170 ASSERT_FALSE(thread.IsRunning()); in TEST()
171 ASSERT_TRUE(PlatformThread::Create(0, &thread, &handle)); in TEST()
172 thread.WaitForTerminationReady(); in TEST()
173 ASSERT_TRUE(thread.IsRunning()); in TEST()
174 EXPECT_NE(thread.thread_id(), main_thread_id); in TEST()
176 thread.MarkForTermination(); in TEST()
178 ASSERT_FALSE(thread.IsRunning()); in TEST()
180 // Make sure that the thread ID is the same across calls. in TEST()
187 FunctionTestThread thread[10]; in TEST() local
188 PlatformThreadHandle handle[arraysize(thread)]; in TEST()
190 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
191 ASSERT_FALSE(thread[n].IsRunning()); in TEST()
193 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
194 ASSERT_TRUE(PlatformThread::Create(0, &thread[n], &handle[n])); in TEST()
195 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
196 thread[n].WaitForTerminationReady(); in TEST()
198 for (size_t n = 0; n < arraysize(thread); n++) { in TEST()
199 ASSERT_TRUE(thread[n].IsRunning()); in TEST()
200 EXPECT_NE(thread[n].thread_id(), main_thread_id); in TEST()
204 EXPECT_NE(thread[i].thread_id(), thread[n].thread_id()); in TEST()
208 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
209 thread[n].MarkForTermination(); in TEST()
210 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
212 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
213 ASSERT_FALSE(thread[n].IsRunning()); in TEST()
215 // Make sure that the thread ID is the same across calls. in TEST()
244 // Confirm that the current thread's priority is as expected. in RunTest()
248 // Alter and verify the current thread's priority. in RunTest()
260 // Test changing a created thread's priority (which has different semantics on
263 // TODO(crbug.com/851759): Thread priorities are not implemented in Fuchsia.
274 // priority of the main thread. Also skip this on platforms that don't allow in TEST()
275 // increasing the priority of a thread. in TEST()
281 // Toggle each supported priority on the thread and confirm it affects it. in TEST()
289 ThreadPriorityTestThread thread(kThreadPriorityTestValues[i]); in TEST() local
292 ASSERT_FALSE(thread.IsRunning()); in TEST()
293 ASSERT_TRUE(PlatformThread::Create(0, &thread, &handle)); in TEST()
294 thread.WaitForTerminationReady(); in TEST()
295 ASSERT_TRUE(thread.IsRunning()); in TEST()
297 thread.MarkForTermination(); in TEST()
299 ASSERT_FALSE(thread.IsRunning()); in TEST()
365 // Construct an excessively long thread name. in TEST()