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

Unified Diff: runtime/vm/thread.h

Issue 1134003005: Automatic thread cleanup on non-Windows platforms. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 5 years, 7 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
Index: runtime/vm/thread.h
===================================================================
--- runtime/vm/thread.h (revision 45810)
+++ runtime/vm/thread.h (working copy)
@@ -17,12 +17,8 @@
// A VM thread; may be executing Dart code or performing helper tasks like
// garbage collection or compilation. The Thread structure associated with
// a thread is allocated when the thread enters an isolate, and destroyed
-// upon an explicit call to CleanUp.
-//
-// NOTE: When the underlying OS thread is started by the embedder, i.e., not
-// part of a ThreadPool managed by the VM, we currently leak the Thread
-// structure after its last isolate exit. We could add an explicit cleanup API,
-// or, on platforms that support it, register a cleanup callback.
+// when the underlying OS thread exits. NOTE: On Windows, Thread::CleanUp
+// must currently be called manually (issue 23474).
class Thread {
public:
// The currently executing thread, or NULL if not yet initialized.
@@ -30,7 +26,7 @@
return reinterpret_cast<Thread*>(OSThread::GetThreadLocal(thread_key_));
}
- // Makes the current thread enter 'isolate'. Also calls EnsureInit.
+ // Makes the current thread enter 'isolate'.
static void EnterIsolate(Isolate* isolate);
// Makes the current thread exit its isolate.
static void ExitIsolate();
@@ -42,10 +38,10 @@
static void EnterIsolateAsHelper(Isolate* isolate);
static void ExitIsolateAsHelper();
- // Initializes the current thread as a VM thread, if not already done.
- static void EnsureInit();
- // Clears the state of the current thread.
+#if defined(TARGET_OS_WINDOWS)
+ // Clears the state of the current thread and frees the allocation.
static void CleanUp();
+#endif
// Called at VM startup.
static void InitOnce();
@@ -64,6 +60,9 @@
void set_cha(CHA* value);
private:
+ // Initializes the current thread as a VM thread, if not already done.
+ static void EnsureInit();
+
static ThreadLocalKey thread_key_;
Isolate* isolate_;
« no previous file with comments | « runtime/vm/os_thread_win.cc ('k') | runtime/vm/thread.cc » ('j') | runtime/vm/thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698