• Home
  • Raw
  • Download

Lines Matching full:thread

11 #include "rtc_base/thread.h"
64 MessageClient(Thread* pth, Socket* socket) : socket_(socket) {} in MessageClient()
82 Thread* post_thread, in SocketClient()
110 Thread* post_thread_;
114 class CustomThread : public rtc::Thread {
117 : Thread(std::unique_ptr<SocketServer>(new rtc::NullSocketServer())) {} in CustomThread()
121 bool WrapCurrent() { return Thread::WrapCurrent(); } in WrapCurrent()
122 void UnwrapCurrent() { Thread::UnwrapCurrent(); } in UnwrapCurrent()
125 // A thread that does nothing when it runs and signals an event
127 class SignalWhenDestroyedThread : public Thread {
130 : Thread(std::unique_ptr<SocketServer>(new NullSocketServer())), in SignalWhenDestroyedThread()
151 // Create the messaging client on its own thread. in TEST()
152 auto th1 = Thread::CreateWithSocketServer(); in TEST()
156 // Create the socket client on its own thread. in TEST()
157 auto th2 = Thread::CreateWithSocketServer(); in TEST()
173 Thread* th_main = Thread::Current(); in TEST()
196 rtc::Thread::ScopedCountBlockingCalls blocked_calls( in TEST()
206 // Test invoking on the current thread. This should not count as an 'actual' in TEST()
209 // (and should not be used a general way to call methods on the same thread). in TEST()
215 // Create a new thread to invoke on. in TEST()
216 auto thread = Thread::CreateWithSocketServer(); in TEST() local
217 thread->Start(); in TEST()
218 EXPECT_EQ(42, thread->BlockingCall([]() { return 42; })); in TEST()
222 thread->Stop(); in TEST()
235 rtc::Thread::ScopedCountBlockingCalls blocked_calls( in TEST()
248 rtc::Thread::ScopedCountBlockingCalls blocked_calls( in TEST()
262 // Test that setting thread names doesn't cause a malfunction.
266 auto thread = Thread::CreateWithSocketServer(); in TEST() local
267 EXPECT_TRUE(thread->Start()); in TEST()
268 thread->Stop(); in TEST()
270 thread = Thread::CreateWithSocketServer(); in TEST()
271 EXPECT_TRUE(thread->SetName("No object", nullptr)); in TEST()
272 EXPECT_TRUE(thread->Start()); in TEST()
273 thread->Stop(); in TEST()
275 thread = Thread::CreateWithSocketServer(); in TEST()
276 EXPECT_TRUE(thread->SetName("Abcdefghijklmnopqrstuvwxyz1234567890", this)); in TEST()
277 EXPECT_TRUE(thread->Start()); in TEST()
278 thread->Stop(); in TEST()
282 Thread* current_thread = Thread::Current(); in TEST()
288 EXPECT_EQ(&cthread, Thread::Current()); in TEST()
300 // Create and start the thread. in TEST()
301 auto thread1 = Thread::CreateWithSocketServer(); in TEST()
302 auto thread2 = Thread::CreateWithSocketServer(); in TEST()
311 // Create and start the thread. in TEST()
312 auto thread1 = Thread::CreateWithSocketServer(); in TEST()
313 auto thread2 = Thread::CreateWithSocketServer(); in TEST()
314 auto thread3 = Thread::CreateWithSocketServer(); in TEST()
315 auto thread4 = Thread::CreateWithSocketServer(); in TEST()
330 // Create and start the thread. in TEST()
331 auto thread1 = Thread::CreateWithSocketServer(); in TEST()
332 auto thread2 = Thread::CreateWithSocketServer(); in TEST()
344 // Create and start the thread. in TEST()
345 auto thread1 = Thread::CreateWithSocketServer(); in TEST()
346 auto thread2 = Thread::CreateWithSocketServer(); in TEST()
354 // Create and start the thread. in TEST()
355 auto thread = Thread::CreateWithSocketServer(); in TEST() local
356 thread->Start(); in TEST()
358 EXPECT_EQ(42, thread->BlockingCall([] { return 42; })); in TEST()
360 thread->BlockingCall([&] { called = true; }); in TEST()
368 EXPECT_EQ(999, thread->BlockingCall(&LocalFuncs::Func1)); in TEST()
369 thread->BlockingCall(&LocalFuncs::Func2); in TEST()
377 AutoThread thread; in TEST() local
378 Thread* main_thread = Thread::Current(); in TEST()
379 auto other_thread = Thread::CreateWithSocketServer(); in TEST()
388 AutoThread thread; in TEST() local
389 Thread* first = Thread::Current(); in TEST()
391 auto second = Thread::Create(); in TEST()
393 auto third = Thread::Create(); in TEST()
404 // Verifies that if thread A invokes a call on thread B and thread C is trying
405 // to invoke A at the same time, thread A does not handle C's invoke while
408 AutoThread thread; in TEST() local
409 Thread* thread_a = Thread::Current(); in TEST()
410 auto thread_b = Thread::CreateWithSocketServer(); in TEST()
411 auto thread_c = Thread::CreateWithSocketServer(); in TEST()
436 static void InvokeSet(Thread* thread, LockedBool* out) { in TEST()
437 thread->BlockingCall([out] { Set(out); }); in TEST()
440 // Set `out` true and call InvokeSet on `thread`. in TEST()
442 Thread* thread, in TEST()
445 InvokeSet(thread, out_inner); in TEST()
450 static void AsyncInvokeSetAndWait(Thread* thread1, in TEST()
451 Thread* thread2, in TEST()
466 // Thread B returns when C receives the call and C should be blocked until A in TEST()
468 Thread* thread_c_ptr = thread_c.get(); in TEST()
479 Thread& q) { in DelayedPostsWithIdenticalTimesAreProcessedInFifoOrder()
502 Thread q(CreateDefaultSocketServer(), true); in TEST()
507 Thread q_nullss(&nullss, true); in TEST()
518 auto a = Thread::CreateWithSocketServer(); in TEST()
519 auto b = Thread::CreateWithSocketServer(); in TEST()
528 // the main thread, which is guaranteed to be handled inside in TEST()
548 // Test that ProcessAllMessageQueues doesn't hang if a thread is quitting.
550 auto t = Thread::CreateWithSocketServer(); in TEST()
594 // A functor that verifies the thread it was destroyed on.
597 DestructionFunctor(Thread* thread, bool* thread_was_current, Event* event) in DestructionFunctor() argument
598 : thread_(thread), in DestructionFunctor()
614 Thread* thread_;
621 std::unique_ptr<rtc::Thread> background_thread(rtc::Thread::Create()); in TEST()
630 std::unique_ptr<rtc::Thread> background_thread(rtc::Thread::Create()); in TEST()
644 std::unique_ptr<rtc::Thread> background_thread(rtc::Thread::Create()); in TEST()
658 std::unique_ptr<rtc::Thread> background_thread(rtc::Thread::Create()); in TEST()
673 std::unique_ptr<rtc::Thread> background_thread(rtc::Thread::Create()); in TEST()
687 std::unique_ptr<rtc::Thread> background_thread(rtc::Thread::Create()); in TEST()
702 std::unique_ptr<rtc::Thread> background_thread(rtc::Thread::Create()); in TEST()
717 std::unique_ptr<rtc::Thread> background_thread(rtc::Thread::Create()); in TEST()
722 Thread* background_thread_ptr = background_thread.get(); in TEST()
734 std::unique_ptr<rtc::Thread> background_thread(rtc::Thread::Create()); in TEST()
738 // thread. The second event ensures that the message is processed. in TEST()
751 std::unique_ptr<rtc::Thread> background_thread(rtc::Thread::Create()); in TEST()
773 std::unique_ptr<rtc::Thread> background_thread(rtc::Thread::Create()); in TEST()
777 // thread. The second event ensures that the message is processed. in TEST()
792 std::unique_ptr<rtc::Thread> background_thread(rtc::Thread::Create()); in TEST()
820 std::unique_ptr<rtc::Thread> thread(rtc::Thread::Create()); in TEST() local
821 thread->WrapCurrent(); in TEST()
823 static_cast<webrtc::TaskQueueBase*>(thread.get())); in TEST()
824 thread->UnwrapCurrent(); in TEST()
834 std::unique_ptr<Thread> thread = Thread::Create(); in CreateTaskQueue() local
835 thread->Start(); in CreateTaskQueue()
837 thread.release()); in CreateTaskQueue()