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

Unified Diff: base/threading/thread.h

Issue 2135413003: Add |joinable| to Thread::Options (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile Created 4 years, 5 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: 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.
//
// 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.

Powered by Google App Engine
This is Rietveld 408576698