- Adds a way to set the current scheduler on the thread to be used whenever a mailbox is created that needs to reply on this thread
20 lines
370 B
C++
20 lines
370 B
C++
#include <mbgl/actor/scheduler.hpp>
|
|
#include <mbgl/util/thread_local.hpp>
|
|
|
|
namespace mbgl {
|
|
|
|
static auto& current() {
|
|
static util::ThreadLocal<Scheduler> scheduler;
|
|
return scheduler;
|
|
};
|
|
|
|
void Scheduler::SetCurrent(Scheduler* scheduler) {
|
|
current().set(scheduler);
|
|
}
|
|
|
|
Scheduler* Scheduler::GetCurrent() {
|
|
return current().get();
|
|
}
|
|
|
|
} //namespace mbgl
|