Home | History | Annotate | Download | only in threading

Lines Matching defs:Thread

31 // A simple thread abstraction that establishes a MessageLoop on a new thread.
32 // The consumer uses the MessageLoop of the thread to cause code to execute on
33 // the thread. When this object is destroyed the thread is terminated. All
34 // pending tasks queued on the thread's message loop will run to completion
35 // before the thread is terminated.
37 // WARNING! SUBCLASSES MUST CALL Stop() IN THEIR DESTRUCTORS! See ~Thread().
39 // After the thread is stopped, the destruction sequence is:
41 // (1) Thread::CleanUp()
45 // This API is not thread-safe: unless indicated otherwise its methods are only
50 // construction, Start(), task_runner()), but to then hand the Thread over to a
52 // case, Thread::DetachFromSequence() allows the owning sequence to give up
55 // Thread object (including ~Thread()).
56 class BASE_EXPORT Thread : PlatformThread::Delegate {
66 // Specifies the type of message loop that will be allocated on the thread.
70 // Specifies timer slack for thread message loop.
74 // on the thread. If message_pump_factory.is_null(), then a MessagePump
79 // Specifies the maximum stack size that the thread is allowed to use.
80 // This does not necessarily correspond to the thread's initial stack size.
84 // Specifies the initial thread priority.
87 // If false, the thread will not be joined on destruction. This is intended
97 // name is a display string to identify the thread.
98 explicit Thread(const std::string& name);
100 // Destroys the thread, stopping it if necessary.
102 // NOTE: ALL SUBCLASSES OF Thread MUST CALL Stop() IN THEIR DESTRUCTORS (or
105 // vtable, and the thread's ThreadMain calling the virtual method Run(). It
108 ~Thread() override;
111 // Causes the thread to initialize COM. This must be called before calling
112 // Start() or StartWithOptions(). If |use_mta| is false, the thread is also
122 // Starts the thread. Returns true if the thread was successfully started;
131 // Starts the thread. Behaves exactly like Start in addition to allow to
139 // Starts the thread and wait for the thread to start and run initialization
143 // jank on the calling thread, should be used only in testing code.
146 // Blocks until the thread starts running. Called within StartAndWait().
147 // Note that calling this causes jank on the calling thread, must be used
151 // Blocks until all tasks previously posted to this thread have been executed.
154 // Signals the thread to exit and returns once the thread has exited. The
155 // Thread object is completely reset and may be used as if it were newly
159 // Stop may be called multiple times and is simply ignored if the thread is
162 // Start/Stop are not thread-safe and callers that desire to invoke them from
165 // NOTE: If you are a consumer of Thread, it is not necessary to call this
166 // before deleting your Thread objects, as the destructor will do it.
167 // IF YOU ARE A SUBCLASS OF Thread, YOU MUST CALL THIS IN YOUR DESTRUCTOR.
170 // Signals the thread to exit in the near future.
175 // deadlock on Windows with printer worker thread. In any other case, Stop()
178 // Call Stop() to reset the thread object once it is known that the thread has
183 // (including ~Thread()) can happen from a different sequence (to which it
189 // Returns the message loop for this thread. Use the MessageLoop's
190 // PostTask methods to execute code on the thread. This only returns
195 // the Thread's Stop method instead.
197 // In addition to this Thread's owning sequence, this can also safely be
198 // called from the underlying thread itself.
201 // such only the owner should access it (and the underlying thread which
217 // Returns a TaskRunner for this thread. Use the TaskRunner's PostTask
218 // methods to execute code on the thread. Returns nullptr if the thread is not
220 // hold on to this even after the thread is gone; in this situation, attempts
223 // In addition to this Thread's owning sequence, this can also safely be
224 // called from the underlying thread itself.
233 // Returns the name of this thread (for display in debugger too).
236 // Returns the thread ID. Should not be called before the first Start*()
240 // WARNING: This function will block if the thread hasn't started yet.
242 // This method is thread-safe.
245 // Returns true if the thread has been started, and not yet stopped.
261 // Bind this Thread to an existing MessageLoop instead of starting a new one.
283 // Whether this thread needs to initialize COM, and if so, in what mode.
287 // Mirrors the Options::joinable field used to start this thread. Verified
293 // Should be written on the thread that created this thread. Also read data
301 // The thread's handle.
305 // The thread's id once it has started.
310 // The thread's MessageLoop and RunLoop. Valid only while the thread is alive.
311 // Set by the created thread.
316 // in which case this Thread has no underlying |thread_| and should merely
323 // a thread.
326 // The name of the thread. Used for debugging purposes.
329 // Signaled when the created thread gets ready to use the message loop.
332 // This class is not thread-safe, use this to verify access from the owning
333 // sequence of the Thread.
336 DISALLOW_COPY_AND_ASSIGN(Thread);