Chromium Code Reviews| Index: base/threading/thread.h |
| diff --git a/base/threading/thread.h b/base/threading/thread.h |
| index 45064240d76f8436ceb7ab51ff205be4646a8485..48cf37f3f42583a75ad7e850970cec746a63697e 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 |
| + // 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. |
|
danakj
2016/07/25 18:32:53
Is there some DCHECK that will fire if you try to
gab
2016/07/25 19:18:29
Yes, stopping_ is never reset when not joining (re
|
| // |
| // 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. |