• Home
  • Raw
  • Download

Lines Matching full:thread

24 // Trivial tests that thread runs and doesn't crash on create, join, or detach -
46 TrivialThread thread; in TEST() local
49 ASSERT_FALSE(thread.run_event().IsSignaled()); in TEST()
50 ASSERT_TRUE(PlatformThread::Create(0, &thread, &handle)); in TEST()
52 ASSERT_TRUE(thread.run_event().IsSignaled()); in TEST()
56 TrivialThread thread[10]; in TEST() local
57 PlatformThreadHandle handle[arraysize(thread)]; in TEST()
59 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
60 ASSERT_FALSE(thread[n].run_event().IsSignaled()); in TEST()
61 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
62 ASSERT_TRUE(PlatformThread::Create(0, &thread[n], &handle[n])); in TEST()
63 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
65 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
66 ASSERT_TRUE(thread[n].run_event().IsSignaled()); in TEST()
70 // end and termination of the thread, but threads could persist shortly after
73 TrivialThread thread; in TEST() local
76 ASSERT_FALSE(thread.run_event().IsSignaled()); in TEST()
77 ASSERT_TRUE(PlatformThread::Create(0, &thread, &handle)); in TEST()
79 thread.run_event().Wait(); in TEST()
83 TrivialThread thread[10]; in TEST() local
84 PlatformThreadHandle handle[arraysize(thread)]; in TEST()
86 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
87 ASSERT_FALSE(thread[n].run_event().IsSignaled()); in TEST()
88 for (size_t n = 0; n < arraysize(thread); n++) { in TEST()
89 ASSERT_TRUE(PlatformThread::Create(0, &thread[n], &handle[n])); in TEST()
92 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
93 thread[n].run_event().Wait(); in TEST()
96 // Tests of basic thread functions ---------------------------------------------
111 << "Need to mark thread for termination and join the underlying thread " in ~FunctionTestThread()
113 << "WaitableEvent blocking the underlying thread's main."; in ~FunctionTestThread()
116 // Grabs |thread_id_|, runs an optional test on that thread, signals
123 // Make sure that the thread ID is the same across calls. in ThreadMain()
136 EXPECT_TRUE(termination_ready_.IsSignaled()) << "Thread ID still unknown"; in thread_id()
144 // Blocks until this thread is started and ready to be terminated.
147 // Marks this thread for termination (callers must then join this thread to be
152 // Runs an optional test on the newly created thread.
169 FunctionTestThread thread; in TEST() local
172 ASSERT_FALSE(thread.IsRunning()); in TEST()
173 ASSERT_TRUE(PlatformThread::Create(0, &thread, &handle)); in TEST()
174 thread.WaitForTerminationReady(); in TEST()
175 ASSERT_TRUE(thread.IsRunning()); in TEST()
176 EXPECT_NE(thread.thread_id(), main_thread_id); in TEST()
178 thread.MarkForTermination(); in TEST()
180 ASSERT_FALSE(thread.IsRunning()); in TEST()
182 // Make sure that the thread ID is the same across calls. in TEST()
189 FunctionTestThread thread[10]; in TEST() local
190 PlatformThreadHandle handle[arraysize(thread)]; in TEST()
192 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
193 ASSERT_FALSE(thread[n].IsRunning()); in TEST()
195 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
196 ASSERT_TRUE(PlatformThread::Create(0, &thread[n], &handle[n])); in TEST()
197 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
198 thread[n].WaitForTerminationReady(); in TEST()
200 for (size_t n = 0; n < arraysize(thread); n++) { in TEST()
201 ASSERT_TRUE(thread[n].IsRunning()); in TEST()
202 EXPECT_NE(thread[n].thread_id(), main_thread_id); in TEST()
206 EXPECT_NE(thread[i].thread_id(), thread[n].thread_id()); in TEST()
210 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
211 thread[n].MarkForTermination(); in TEST()
212 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
214 for (size_t n = 0; n < arraysize(thread); n++) in TEST()
215 ASSERT_FALSE(thread[n].IsRunning()); in TEST()
217 // Make sure that the thread ID is the same across calls. in TEST()
240 // Only root can raise thread priority on POSIX environment. On Linux, users in IsBumpingPriorityAllowed()
241 // who have CAP_SYS_NICE permission also can raise the thread priority, but in IsBumpingPriorityAllowed()
257 // Confirm that the current thread's priority is as expected. in RunTest()
261 // Alter and verify the current thread's priority. in RunTest()
273 // Test changing a created thread's priority (which has different semantics on
283 // Toggle each supported priority on the thread and confirm it affects it. in TEST()
291 ThreadPriorityTestThread thread(kThreadPriorityTestValues[i]); in TEST() local
294 ASSERT_FALSE(thread.IsRunning()); in TEST()
295 ASSERT_TRUE(PlatformThread::Create(0, &thread, &handle)); in TEST()
296 thread.WaitForTerminationReady(); in TEST()
297 ASSERT_TRUE(thread.IsRunning()); in TEST()
299 thread.MarkForTermination(); in TEST()
301 ASSERT_FALSE(thread.IsRunning()); in TEST()