Allow overwriting current thread in ThreadManager.
This prepares for introducing a simulated time rtc::ThreadManager
implementation that will run on a single underlying thread.
Bug: webrtc:11255
Change-Id: I793128cc0b8e649a3675914de67dfee3298b446a
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/165765
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#30256}
diff --git a/rtc_base/thread.h b/rtc_base/thread.h
index b8af583..f8b41d1 100644
--- a/rtc_base/thread.h
+++ b/rtc_base/thread.h
@@ -90,6 +90,9 @@
Thread* CurrentThread();
void SetCurrentThread(Thread* thread);
+ // Allows changing the current thread, this is intended for tests where we
+ // want to simulate multiple threads running on a single physical thread.
+ void ChangeCurrentThreadForTest(Thread* thread);
// Returns a thread object with its thread_ ivar set
// to whatever the OS uses to represent the thread.
@@ -113,6 +116,7 @@
ThreadManager();
~ThreadManager();
+ void SetCurrentThreadInternal(Thread* thread);
void AddInternal(Thread* message_queue);
void RemoveInternal(Thread* message_queue);
void ClearInternal(MessageHandler* handler);