Implement get_scheduler_thread_id without threads.
This commit is contained in:
parent
8b4bc80860
commit
71e3011afa
@ -70,11 +70,13 @@ void ConcurrentScheduler::test_one_thread_run() {
|
||||
} while (!is_finished_.load(std::memory_order_relaxed));
|
||||
}
|
||||
|
||||
#if !TD_THREAD_UNSUPPORTED
|
||||
thread::id ConcurrentScheduler::get_scheduler_thread_id(int32 sched_id) {
|
||||
auto thread_pos = static_cast<size_t>(sched_id - 1);
|
||||
CHECK(thread_pos < threads_.size());
|
||||
return threads_[thread_pos].get_id();
|
||||
}
|
||||
#endif
|
||||
|
||||
void ConcurrentScheduler::start() {
|
||||
CHECK(state_ == State::Start);
|
||||
|
@ -50,7 +50,13 @@ class ConcurrentScheduler final : private Scheduler::Callback {
|
||||
return is_finished_.load(std::memory_order_relaxed);
|
||||
}
|
||||
|
||||
#if TD_THREAD_UNSUPPORTED
|
||||
int get_scheduler_thread_id(int32 sched_id) {
|
||||
return 1;
|
||||
}
|
||||
#else
|
||||
thread::id get_scheduler_thread_id(int32 sched_id);
|
||||
#endif
|
||||
|
||||
void start();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user