Index: base/threading/thread.h |
diff --git a/base/threading/thread.h b/base/threading/thread.h |
index 720ba8b6be80755e4ea833c1cd18d9f7193bbed2..e15a243b1b022586a162886187a32290e498f7a9 100644 |
--- a/base/threading/thread.h |
+++ b/base/threading/thread.h |
@@ -74,6 +74,12 @@ class BASE_EXPORT Thread : PlatformThread::Delegate { |
// Specifies the initial thread priority. |
ThreadPriority priority = ThreadPriority::NORMAL; |
+ |
+ // If false, the thread will not be joined on destruction. This is intended |
+ // for threads that want TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN |
+ // semantics. Stop() will not be synchronous and will instead merely have |
+ // StopSoon() semantics on such threads. |
+ bool joinable = true; |
}; |
// Constructor. |
@@ -131,12 +137,14 @@ class BASE_EXPORT Thread : PlatformThread::Delegate { |
// carefully for production code. |
bool WaitUntilThreadStarted() const; |
- // Signals the thread to exit and returns once the thread has exited. After |
- // this method returns, the Thread object is completely reset and may be used |
- // as if it were newly constructed (i.e., Start may be called again). |
+ // Signals the thread to exit and returns once the thread has exited (or right |
danakj
2016/07/22 21:00:40
A thought: what if we made it illegal to call Stop
gab
2016/07/25 16:07:40
That was my first instinct too, but then I realize
|
+ // away if the thread is non-joinable). For joinable threads only: after this |
+ // method returns, the Thread object is completely reset and may be used as if |
+ // it were newly constructed (i.e., Start may be called again) -- non-joinable |
+ // threads are not re-usable. |
// |
// Stop may be called multiple times and is simply ignored if the thread is |
- // already stopped. |
+ // already stopped or currently stopping. |
// |
// NOTE: If you are a consumer of Thread, it is not necessary to call this |
// before deleting your Thread objects, as the destructor will do it. |