| Index: runtime/vm/thread.h
|
| diff --git a/runtime/vm/thread.h b/runtime/vm/thread.h
|
| index 44b804013e7b6ec3c85ff4c0d8ef290d7ac88ca5..ccf7435f75252605e9366357b5c2969b0c9e32ca 100644
|
| --- a/runtime/vm/thread.h
|
| +++ b/runtime/vm/thread.h
|
| @@ -39,6 +39,26 @@ class Zone;
|
| CACHED_VM_OBJECTS_LIST(V) \
|
| CACHED_ADDRESSES_LIST(V)
|
|
|
| +struct InterruptedThreadState {
|
| + ThreadId tid;
|
| + uintptr_t pc;
|
| + uintptr_t csp;
|
| + uintptr_t dsp;
|
| + uintptr_t fp;
|
| + uintptr_t lr;
|
| +};
|
| +
|
| +// 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 -- Because on Windows the callback will be running in a
|
| +// different thread.
|
| +// * Allocating memory -- Because this takes locks which may already be held,
|
| +// resulting in a dead lock.
|
| +// * Taking a lock -- See above.
|
| +typedef void (*ThreadInterruptCallback)(const InterruptedThreadState& state,
|
| + void* data);
|
|
|
| // A VM thread; may be executing Dart code or performing helper tasks like
|
| // garbage collection or compilation. The Thread structure associated with
|
| @@ -233,9 +253,22 @@ CACHED_CONSTANTS_LIST(DEFINE_OFFSET_METHOD)
|
| state_.long_jump_base = value;
|
| }
|
|
|
| + ThreadId id() const {
|
| + ASSERT(id_ != OSThread::kInvalidThreadId);
|
| + return id_;
|
| + }
|
| +
|
| + void SetThreadInterrupter(ThreadInterruptCallback callback, void* data);
|
| +
|
| + bool IsThreadInterrupterEnabled(ThreadInterruptCallback* callback,
|
| + void** data) const;
|
| +
|
| private:
|
| static ThreadLocalKey thread_key_;
|
|
|
| + const ThreadId id_;
|
| + ThreadInterruptCallback thread_interrupt_callback_;
|
| + void* thread_interrupt_data_;
|
| Isolate* isolate_;
|
| Heap* heap_;
|
| State state_;
|
|
|