| Index: runtime/vm/thread_interrupter.cc
|
| diff --git a/runtime/vm/thread_interrupter.cc b/runtime/vm/thread_interrupter.cc
|
| index 23e6c22fc4df17365db199763c694b035edc0769..0cf7c3814b1badcc1a8c839c3ecdaef9730b872b 100644
|
| --- a/runtime/vm/thread_interrupter.cc
|
| +++ b/runtime/vm/thread_interrupter.cc
|
| @@ -148,93 +148,6 @@ void ThreadInterrupter::WakeUp() {
|
| }
|
| }
|
|
|
| -// Register the currently running thread for interrupts. If the current thread
|
| -// is already registered, callback and data will be updated.
|
| -InterruptableThreadState* ThreadInterrupter::Register(
|
| - ThreadInterruptCallback callback, void* data) {
|
| - if (shutdown_) {
|
| - return NULL;
|
| - }
|
| - ASSERT(initialized_);
|
| - InterruptableThreadState* state = _EnsureThreadStateCreated();
|
| - // Set callback and data.
|
| - UpdateStateObject(callback, data);
|
| - return state;
|
| -}
|
| -
|
| -
|
| -// Unregister the currently running thread for interrupts.
|
| -void ThreadInterrupter::Unregister() {
|
| - if (shutdown_) {
|
| - return;
|
| - }
|
| - ASSERT(initialized_);
|
| - _EnsureThreadStateCreated();
|
| - // Clear callback and data.
|
| - UpdateStateObject(NULL, NULL);
|
| -}
|
| -
|
| -
|
| -InterruptableThreadState* ThreadInterrupter::_EnsureThreadStateCreated() {
|
| - InterruptableThreadState* state = CurrentThreadState();
|
| - if (state == NULL) {
|
| - // Create thread state object lazily.
|
| - ThreadId current_thread = OSThread::GetCurrentThreadId();
|
| - if (FLAG_trace_thread_interrupter) {
|
| - intptr_t tid = OSThread::ThreadIdToIntPtr(current_thread);
|
| - OS::Print("ThreadInterrupter Tracking %p\n",
|
| - reinterpret_cast<void*>(tid));
|
| - }
|
| - // Note: We currently do not free a thread's InterruptableThreadState.
|
| - state = new InterruptableThreadState();
|
| - ASSERT(state != NULL);
|
| - state->callback = NULL;
|
| - state->data = NULL;
|
| - state->id = current_thread;
|
| - SetCurrentThreadState(state);
|
| - }
|
| - return state;
|
| -}
|
| -
|
| -
|
| -void ThreadInterrupter::UpdateStateObject(ThreadInterruptCallback callback,
|
| - void* data) {
|
| - InterruptableThreadState* state = CurrentThreadState();
|
| - ThreadId current_thread = OSThread::GetCurrentThreadId();
|
| - ASSERT(state != NULL);
|
| - ASSERT(OSThread::Compare(state->id, OSThread::GetCurrentThreadId()));
|
| - SetCurrentThreadState(NULL);
|
| - // It is now safe to modify the state object. If an interrupt occurs,
|
| - // the current thread state will be NULL.
|
| - state->callback = callback;
|
| - state->data = data;
|
| - SetCurrentThreadState(state);
|
| - if (FLAG_trace_thread_interrupter) {
|
| - intptr_t tid = OSThread::ThreadIdToIntPtr(current_thread);
|
| - if (callback == NULL) {
|
| - OS::Print("ThreadInterrupter Cleared %p\n", reinterpret_cast<void*>(tid));
|
| - } else {
|
| - OS::Print("ThreadInterrupter Updated %p\n", reinterpret_cast<void*>(tid));
|
| - }
|
| - }
|
| -}
|
| -
|
| -
|
| -InterruptableThreadState* ThreadInterrupter::GetCurrentThreadState() {
|
| - return _EnsureThreadStateCreated();
|
| -}
|
| -
|
| -
|
| -InterruptableThreadState* ThreadInterrupter::CurrentThreadState() {
|
| - Thread* thread = Thread::Current();
|
| - return (thread == NULL) ? NULL : thread->thread_state();
|
| -}
|
| -
|
| -
|
| -void ThreadInterrupter::SetCurrentThreadState(InterruptableThreadState* state) {
|
| - Thread::Current()->set_thread_state(state);
|
| -}
|
| -
|
|
|
| void ThreadInterruptNoOp(const InterruptedThreadState& state, void* data) {
|
| // NoOp.
|
|
|