• Home
  • Raw
  • Download

Lines Matching full:thread

11 #include "rtc_base/thread.h"
116 void ThreadManager::Add(Thread* message_queue) { in Add()
119 void ThreadManager::AddInternal(Thread* message_queue) { in AddInternal()
127 void ThreadManager::Remove(Thread* message_queue) { in Remove()
130 void ThreadManager::RemoveInternal(Thread* message_queue) { in RemoveInternal()
135 std::vector<Thread*>::iterator iter; in RemoveInternal()
147 void ThreadManager::RemoveFromSendGraph(Thread* thread) { in RemoveFromSendGraph() argument
149 if (it->first == thread) { in RemoveFromSendGraph()
152 it->second.erase(thread); in RemoveFromSendGraph()
158 void ThreadManager::RegisterSendAndCheckForCycles(Thread* source, in RegisterSendAndCheckForCycles()
159 Thread* target) { in RegisterSendAndCheckForCycles()
164 std::deque<Thread*> all_targets({target}); in RegisterSendAndCheckForCycles()
194 for (Thread* queue : message_queues_) { in ProcessAllMessageQueuesInternal()
202 // Whether the task is processed, or the thread is simply cleared, in ProcessAllMessageQueuesInternal()
211 rtc::Thread* current = rtc::Thread::Current(); in ProcessAllMessageQueuesInternal()
212 // Note: One of the message queues may have been on this thread, which is in ProcessAllMessageQueuesInternal()
223 Thread* Thread::Current() { in Current()
225 Thread* thread = manager->CurrentThread(); in Current() local
227 return thread; in Current()
238 Thread* ThreadManager::CurrentThread() { in CurrentThread()
239 return static_cast<Thread*>(pthread_getspecific(key_)); in CurrentThread()
242 void ThreadManager::SetCurrentThreadInternal(Thread* thread) { in SetCurrentThreadInternal() argument
243 pthread_setspecific(key_, thread); in SetCurrentThreadInternal()
250 Thread* ThreadManager::CurrentThread() { in CurrentThread()
251 return static_cast<Thread*>(TlsGetValue(key_)); in CurrentThread()
254 void ThreadManager::SetCurrentThreadInternal(Thread* thread) { in SetCurrentThreadInternal() argument
255 TlsSetValue(key_, thread); in SetCurrentThreadInternal()
259 void ThreadManager::SetCurrentThread(Thread* thread) { in SetCurrentThread() argument
261 if (CurrentThread() && thread) { in SetCurrentThread()
266 if (thread) { in SetCurrentThread()
267 thread->EnsureIsCurrentTaskQueue(); in SetCurrentThread()
269 Thread* current = CurrentThread(); in SetCurrentThread()
271 // The current thread is being cleared, e.g. as a result of in SetCurrentThread()
272 // UnwrapCurrent() being called or when a thread is being stopped in SetCurrentThread()
273 // (see PreRun()). This signals that the Thread instance is being detached in SetCurrentThread()
274 // from the thread, which also means that TaskQueue::Current() must not in SetCurrentThread()
275 // return a pointer to the Thread instance. in SetCurrentThread()
280 SetCurrentThreadInternal(thread); in SetCurrentThread()
283 void rtc::ThreadManager::ChangeCurrentThreadForTest(rtc::Thread* thread) { in ChangeCurrentThreadForTest() argument
284 SetCurrentThreadInternal(thread); in ChangeCurrentThreadForTest()
287 Thread* ThreadManager::WrapCurrentThread() { in WrapCurrentThread()
288 Thread* result = CurrentThread(); in WrapCurrentThread()
290 result = new Thread(CreateDefaultSocketServer()); in WrapCurrentThread()
297 Thread* t = CurrentThread(); in UnwrapCurrentThread()
304 Thread::ScopedDisallowBlockingCalls::ScopedDisallowBlockingCalls() in ScopedDisallowBlockingCalls()
305 : thread_(Thread::Current()), in ScopedDisallowBlockingCalls()
308 Thread::ScopedDisallowBlockingCalls::~ScopedDisallowBlockingCalls() { in ~ScopedDisallowBlockingCalls()
314 Thread::ScopedCountBlockingCalls::ScopedCountBlockingCalls( in ScopedCountBlockingCalls()
316 : thread_(Thread::Current()), in ScopedCountBlockingCalls()
322 Thread::ScopedCountBlockingCalls::~ScopedCountBlockingCalls() { in ~ScopedCountBlockingCalls()
328 uint32_t Thread::ScopedCountBlockingCalls::GetBlockingCallCount() const { in GetBlockingCallCount()
332 uint32_t Thread::ScopedCountBlockingCalls::GetCouldBeBlockingCallCount() const { in GetCouldBeBlockingCallCount()
337 uint32_t Thread::ScopedCountBlockingCalls::GetTotalBlockedCallCount() const { in GetTotalBlockedCallCount()
342 Thread::Thread(SocketServer* ss) : Thread(ss, /*do_init=*/true) {} in Thread() function in rtc::Thread
344 Thread::Thread(std::unique_ptr<SocketServer> ss) in Thread() function in rtc::Thread
345 : Thread(std::move(ss), /*do_init=*/true) {} in Thread()
347 Thread::Thread(SocketServer* ss, bool do_init) in Thread() function in rtc::Thread
355 SetName("Thread", this); // default name in Thread()
361 Thread::Thread(std::unique_ptr<SocketServer> ss, bool do_init) in Thread() function in rtc::Thread
362 : Thread(ss.get(), do_init) { in Thread()
366 Thread::~Thread() { in ~Thread()
371 void Thread::DoInit() { in DoInit()
380 void Thread::DoDestroy() { in DoDestroy()
398 SocketServer* Thread::socketserver() { in socketserver()
402 void Thread::WakeUpSocketServer() { in WakeUpSocketServer()
406 void Thread::Quit() { in Quit()
411 bool Thread::IsQuitting() { in IsQuitting()
415 void Thread::Restart() { in Restart()
419 absl::AnyInvocable<void() &&> Thread::Get(int cmsWait) { in Get()
486 void Thread::PostTask(absl::AnyInvocable<void() &&> task) { in PostTask()
491 // Keep thread safe in PostTask()
502 void Thread::PostDelayedHighPrecisionTask(absl::AnyInvocable<void() &&> task, in PostDelayedHighPrecisionTask()
508 // Keep thread safe in PostDelayedHighPrecisionTask()
529 int Thread::GetDelay() { in GetDelay()
545 void Thread::Dispatch(absl::AnyInvocable<void() &&> task) { in Dispatch()
546 TRACE_EVENT0("webrtc", "Thread::Dispatch"); in Dispatch()
561 bool Thread::IsCurrent() const { in IsCurrent()
565 std::unique_ptr<Thread> Thread::CreateWithSocketServer() { in CreateWithSocketServer()
566 return std::unique_ptr<Thread>(new Thread(CreateDefaultSocketServer())); in CreateWithSocketServer()
569 std::unique_ptr<Thread> Thread::Create() { in Create()
570 return std::unique_ptr<Thread>( in Create()
571 new Thread(std::unique_ptr<SocketServer>(new NullSocketServer()))); in Create()
574 bool Thread::SleepMs(int milliseconds) { in SleepMs()
595 bool Thread::SetName(absl::string_view name, const void* obj) { in SetName()
609 void Thread::SetDispatchWarningMs(int deadline) { in SetDispatchWarningMs()
618 bool Thread::Start() { in Start()
624 Restart(); // reset IsQuitting() if the thread is being restarted in Start()
626 // Make sure that ThreadManager is created on the main thread before in Start()
627 // we start a new thread. in Start()
652 bool Thread::WrapCurrent() { in WrapCurrent()
656 void Thread::UnwrapCurrent() { in UnwrapCurrent()
657 // Clears the platform-specific thread-specific storage. in UnwrapCurrent()
663 << "When unwrapping thread, failed to close handle."; in UnwrapCurrent()
673 void Thread::SafeWrapCurrent() { in SafeWrapCurrent()
677 void Thread::Join() { in Join()
683 RTC_LOG(LS_WARNING) << "Waiting for the thread to join, " in Join()
699 bool Thread::SetAllowBlockingCalls(bool allow) { in SetAllowBlockingCalls()
707 void Thread::AssertBlockingIsAllowedOnCurrentThread() { in AssertBlockingIsAllowedOnCurrentThread()
709 Thread* current = Thread::Current(); in AssertBlockingIsAllowedOnCurrentThread()
716 DWORD WINAPI Thread::PreRun(LPVOID pv) { in PreRun()
718 void* Thread::PreRun(void* pv) { in PreRun()
720 Thread* thread = static_cast<Thread*>(pv); in PreRun() local
721 ThreadManager::Instance()->SetCurrentThread(thread); in PreRun()
722 rtc::SetCurrentThreadName(thread->name_.c_str()); in PreRun()
726 thread->Run(); in PreRun()
736 void Thread::Run() { in PreRun()
740 bool Thread::IsOwned() { in PreRun()
745 void Thread::Stop() { in PreRun()
746 Thread::Quit(); in PreRun()
750 void Thread::BlockingCall(rtc::FunctionView<void()> functor) { in PreRun()
751 TRACE_EVENT0("webrtc", "Thread::BlockingCall"); in PreRun()
769 Thread* current_thread = Thread::Current(); in PreRun()
813 // Thread, that weren't relevant to this Send. Losing these WakeUps can in PreRun()
817 // Win32SocketServer on thread A calls Send on thread B. While processing in PreRun()
818 // the message, thread B Posts a message to A. We consume the wakeup for in PreRun()
831 // Called by the ThreadManager when being set as the current thread. in PreRun()
832 void Thread::EnsureIsCurrentTaskQueue() { in PreRun()
837 // Called by the ThreadManager when being set as the current thread. in PreRun()
838 void Thread::ClearCurrentTaskQueue() { in PreRun()
842 void Thread::AllowInvokesToThread(Thread* thread) { in PreRun() argument
845 PostTask([thread, this]() { AllowInvokesToThread(thread); }); in PreRun()
849 allowed_threads_.push_back(thread); in PreRun()
854 void Thread::DisallowAllInvokes() { in PreRun()
867 uint32_t Thread::GetBlockingCallCount() const { in PreRun()
871 uint32_t Thread::GetCouldBeBlockingCallCount() const { in PreRun()
878 // that permits invocation to `target` thread. in PreRun()
879 bool Thread::IsInvokeToThreadAllowed(rtc::Thread* target) { in PreRun()
885 for (const auto* thread : allowed_threads_) { in PreRun() local
886 if (thread == target) { in PreRun()
896 void Thread::Delete() { in PreRun()
901 void Thread::PostDelayedTask(absl::AnyInvocable<void() &&> task, in PreRun()
907 bool Thread::IsProcessingMessagesForTesting() { in PreRun()
911 bool Thread::ProcessMessages(int cmsLoop) { in PreRun()
937 bool Thread::WrapCurrentWithThreadManager(ThreadManager* thread_manager, in PreRun()
947 RTC_LOG_GLE(LS_ERROR) << "Unable to get handle to thread."; in PreRun()
960 bool Thread::IsRunning() { in PreRun()
969 : Thread(CreateDefaultSocketServer(), /*do_init=*/false) { in PreRun()
972 // be rtc::Thread::Current(), otherwise ProcessAllMessageQueuesInternal will in PreRun()
973 // post a message to a queue that no running thread is serving. in PreRun()
988 : Thread(ss, /*do_init=*/false) { in PreRun()
991 // Temporarily set the current thread to nullptr so that we can keep checks in PreRun()
1002 // Stop and destroy the thread before clearing it as the current thread. in PreRun()
1003 // Sometimes there are messages left in the Thread that will be in PreRun()
1005 // its contents rely on this thread still being set as the current thread. in PreRun()