Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Unified Diff: runtime/vm/thread_interrupter.h

Issue 1293253005: Completely remove InterruptableThreadState and Fix ThreadRegistry leak (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/thread.cc ('k') | runtime/vm/thread_interrupter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/thread_interrupter.h
diff --git a/runtime/vm/thread_interrupter.h b/runtime/vm/thread_interrupter.h
index 473b6fa23e3df96094cb1534d18317807267151c..0fa00e1e0262042d11dbdf01d20a155f6a446440 100644
--- a/runtime/vm/thread_interrupter.h
+++ b/runtime/vm/thread_interrupter.h
@@ -8,37 +8,10 @@
#include "vm/allocation.h"
#include "vm/signal_handler.h"
#include "vm/os_thread.h"
-
+#include "vm/thread.h"
namespace dart {
-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.
-// * Allocating memory.
-// * Taking a lock.
-typedef void (*ThreadInterruptCallback)(const InterruptedThreadState& state,
- void* data);
-
-// State stored per registered thread.
-class InterruptableThreadState {
- public:
- ThreadId id;
- ThreadInterruptCallback callback;
- void* data;
-};
-
class ThreadInterrupter : public AllStatic {
public:
static void InitOnce();
@@ -54,19 +27,13 @@ class ThreadInterrupter : public AllStatic {
// 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,
- void* data);
+ static void Register(ThreadInterruptCallback callback, void* data);
+
// Unregister the currently running thread for interrupts.
static void Unregister();
- // Get the current thread state. Will create a thread state if one hasn't
- // been allocated.
- static InterruptableThreadState* GetCurrentThreadState();
- // Get the current thread state. Will not create one if one doesn't exist.
- static InterruptableThreadState* CurrentThreadState();
-
// Interrupt a thread.
- static void InterruptThread(InterruptableThreadState* thread_state);
+ static void InterruptThread(Thread* thread);
private:
static const intptr_t kMaxThreads = 4096;
@@ -82,11 +49,8 @@ class ThreadInterrupter : public AllStatic {
return current_wait_time_ == Monitor::kNoTimeout;
}
- static InterruptableThreadState* _EnsureThreadStateCreated();
static void UpdateStateObject(ThreadInterruptCallback callback, void* data);
- static void SetCurrentThreadState(InterruptableThreadState* state);
-
static void ThreadMain(uword parameters);
static void InstallSignalHandler();
« no previous file with comments | « runtime/vm/thread.cc ('k') | runtime/vm/thread_interrupter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698