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

Unified Diff: runtime/vm/os_thread.h

Issue 1537543002: Fix for issue 25236 (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: code-review-comments Created 5 years 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/isolate.cc ('k') | runtime/vm/os_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/os_thread.h
diff --git a/runtime/vm/os_thread.h b/runtime/vm/os_thread.h
index 9371b4538ae3d44227f23d13f58ac3bcd182551e..2b825b8a6952d41abda3f509e39c243d7c99279f 100644
--- a/runtime/vm/os_thread.h
+++ b/runtime/vm/os_thread.h
@@ -50,7 +50,10 @@ class BaseThread {
// Low-level operations on OS platform threads.
class OSThread : public BaseThread {
public:
- OSThread();
+ // The constructor of OSThread is never called directly, instead we call
+ // this factory style method 'CreateOSThread' to create OSThread structures.
+ // The method can return a NULL if the Dart VM is in shutdown mode.
+ static OSThread* CreateOSThread();
~OSThread();
ThreadId id() const {
@@ -175,12 +178,19 @@ class OSThread : public BaseThread {
static bool IsThreadInList(ThreadJoinId join_id);
+ static void DisableOSThreadCreation();
+ static void EnableOSThreadCreation();
+
static const intptr_t kStackSizeBuffer = (4 * KB * kWordSize);
static const ThreadId kInvalidThreadId;
static const ThreadJoinId kInvalidThreadJoinId;
private:
+ // The constructor is private as CreateOSThread should be used
+ // to create a new OSThread structure.
+ OSThread();
+
// These methods should not be used in a generic way and hence
// are private, they have been added to solve the problem of
// accessing the VM thread structure from an OSThread object
@@ -196,7 +206,7 @@ class OSThread : public BaseThread {
static ThreadId GetCurrentThreadTraceId();
static ThreadJoinId GetCurrentThreadJoinId();
static OSThread* GetOSThreadFromThread(Thread* thread);
- static void AddThreadToList(OSThread* thread);
+ static void AddThreadToListLocked(OSThread* thread);
static void RemoveThreadFromList(OSThread* thread);
static OSThread* CreateAndSetUnknownThread();
@@ -220,6 +230,7 @@ class OSThread : public BaseThread {
static OSThread* thread_list_head_;
static Mutex* thread_list_lock_;
+ static bool creation_enabled_;
friend class OSThreadIterator;
friend class ThreadInterrupterWin;
« no previous file with comments | « runtime/vm/isolate.cc ('k') | runtime/vm/os_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698