Home | History | Annotate | Download | only in threading

Lines Matching defs:Thread

5 #include "base/threading/thread.h"
32 // We use this thread-local variable to record whether or not a thread exited
35 // using a Thread to setup and run a MessageLoop.
41 Thread::Options::Options() = default;
43 Thread::Options::Options(MessageLoop::Type type, size_t size)
46 Thread::Options::Options(const Options& other) = default;
48 Thread::Options::~Options() = default;
50 Thread::Thread(const std::string& name)
63 Thread::~Thread() {
67 bool Thread::Start() {
78 bool Thread::StartWithOptions(const Options& options) {
82 DCHECK(!stopping_) << "Starting a non-joinable thread a second time? That's "
89 // Reset |id_| here to support restarting the thread.
105 // Hold |thread_lock_| while starting the new thread to synchronize with
117 DLOG(ERROR) << "failed to create thread";
125 // The ownership of |message_loop_| is managed by the newly created thread
133 bool Thread::StartAndWaitForTesting() {
142 bool Thread::WaitUntilThreadStarted() const {
151 void Thread::FlushForTesting() {
163 void Thread::Stop() {
178 // Wait for the thread to exit.
181 // the thread exits. Some consumers are abusing the API. Make them stop.
186 // The thread should nullify |message_loop_| on exit (note: Join() adds an
193 void Thread::StopSoon() {
205 // thread to be considered "stopped" per it having never set its |running_|
213 FROM_HERE, base::Bind(&Thread::ThreadQuitHelper, Unretained(this)));
216 void Thread::DetachFromSequence() {
221 PlatformThreadId Thread::GetThreadId() const {
222 // If the thread is created but not started yet, wait for |id_| being ready.
228 bool Thread::IsRunning() const {
233 // If the thread's already started (i.e. |message_loop_| is non-null) and not
236 // started the new thread so we need no locking here.)
239 // Otherwise check the |running_| flag, which is set to true by the new thread
245 void Thread::Run(RunLoop* run_loop) {
254 void Thread::SetThreadWasQuitProperly(bool flag) {
259 bool Thread::GetThreadWasQuitProperly() {
267 void Thread::SetMessageLoop(MessageLoop* message_loop) {
271 // Setting |message_loop_| should suffice for this thread to be considered
280 void Thread::ThreadMain() {
282 // any place in the following thread initialization code.
292 // Complete the initialization of our Thread object.
296 // Lazily initialize the |message_loop| so that it can run on this thread.
321 // Let the thread do extra initialization.
340 // Let the thread do extra cleanup.
360 void Thread::ThreadQuitHelper() {