diff options
| author | levlam <levlam@telegram.org> | 2022-10-04 23:12:50 +0300 |
|---|---|---|
| committer | levlam <levlam@telegram.org> | 2022-10-04 23:12:50 +0300 |
| commit | 7aa6f2bf91ef3a1a32a5f6222ff002b602950822 (patch) | |
| tree | 4d461525ea3466591f37539c5ad8a9fe5fe53707 /tdactor/td/actor/ConcurrentScheduler.cpp | |
| parent | 67aa7082d6fa8453f060143a88384478f5fb9365 (diff) | |
Add ConcurrentScheduler::get_thread_id.
Diffstat (limited to 'tdactor/td/actor/ConcurrentScheduler.cpp')
| -rw-r--r-- | tdactor/td/actor/ConcurrentScheduler.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tdactor/td/actor/ConcurrentScheduler.cpp b/tdactor/td/actor/ConcurrentScheduler.cpp index c904295ad..f3d20ca29 100644 --- a/tdactor/td/actor/ConcurrentScheduler.cpp +++ b/tdactor/td/actor/ConcurrentScheduler.cpp @@ -70,6 +70,12 @@ void ConcurrentScheduler::test_one_thread_run() { } while (!is_finished_.load(std::memory_order_relaxed)); } +thread::id ConcurrentScheduler::get_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(); +} + void ConcurrentScheduler::start() { CHECK(state_ == State::Start); is_finished_.store(false, std::memory_order_relaxed); @@ -100,6 +106,7 @@ void ConcurrentScheduler::start() { state_ = State::Run; } + static TD_THREAD_LOCAL double emscripten_timeout; bool ConcurrentScheduler::run_main(Timestamp timeout) { |
