| Index: runtime/vm/thread_interrupter.h
|
| diff --git a/runtime/vm/thread_interrupter.h b/runtime/vm/thread_interrupter.h
|
| index 9ee100e33509e2e6fe44355a98ff55d86558e80f..aaa9da40631960516b15042206f64698fd90b66d 100644
|
| --- a/runtime/vm/thread_interrupter.h
|
| +++ b/runtime/vm/thread_interrupter.h
|
| @@ -19,10 +19,9 @@ struct InterruptedThreadState {
|
| uintptr_t fp;
|
| };
|
|
|
| -// When a thread is interrupted the thread specific interrupt
|
| -// callback will be invoked at the interrupt period. Each callback is given an
|
| -// InterruptedThreadState and the thread specific data pointer. When inside a
|
| -// thread interrupt callback doing any of the following
|
| +// When a thread is interrupted the thread specific interrupt callback will be
|
| +// invoked. Each callback is given an InterruptedThreadState and the user data
|
| +// pointer. When inside a thread interrupt callback doing any of the following
|
| // is forbidden:
|
| // * Accessing TLS.
|
| // * Allocating memory.
|
| @@ -48,6 +47,9 @@ class ThreadInterrupter : public AllStatic {
|
| // Delay between interrupts.
|
| static void SetInterruptPeriod(intptr_t period);
|
|
|
| + // Wake up the thread interrupter thread.
|
| + static void WakeUp();
|
| +
|
| // Register the currently running thread for interrupts. If the current thread
|
| // is already registered, callback and data will be updated.
|
| static InterruptableThreadState* Register(ThreadInterruptCallback callback,
|
| @@ -72,8 +74,13 @@ class ThreadInterrupter : public AllStatic {
|
| static ThreadId interrupter_thread_id_;
|
| static Monitor* monitor_;
|
| static intptr_t interrupt_period_;
|
| + static intptr_t current_wait_time_;
|
| static ThreadLocalKey thread_state_key_;
|
|
|
| + static bool InDeepSleep() {
|
| + return current_wait_time_ == Monitor::kNoTimeout;
|
| + }
|
| +
|
| static InterruptableThreadState* _EnsureThreadStateCreated();
|
| static void UpdateStateObject(ThreadInterruptCallback callback, void* data);
|
|
|
|
|