Shaka Packager SDK
Public Member Functions | Protected Member Functions | List of all members
shaka::media::ClosureThread Class Reference

#include <closure_thread.h>

Inheritance diagram for shaka::media::ClosureThread:

Public Member Functions

 ClosureThread (const std::string &name_prefix, const base::Closure &task)
 
 ~ClosureThread () override
 The destructor calls Join automatically if it is not yet joined.
 

Protected Member Functions

void Run () override
 SimpleThread implementation overrides.
 

Detailed Description

Class for creating a thread which invokes a closure. Start() starts the thread and invokes the given closure inside the thread.

NOTE: It is invalid to destroy a ClosureThread without Start() having been called (and a thread never created).

Thread Safety: A ClosureThread is not completely thread safe. It is safe to access it from the creating thread or from the newly created thread. This implies that the creator thread should be the thread that calls Join.

Definition at line 25 of file closure_thread.h.

Constructor & Destructor Documentation

◆ ClosureThread()

shaka::media::ClosureThread::ClosureThread ( const std::string &  name_prefix,
const base::Closure &  task 
)
explicit

Create a ClosureThread. The thread will not be created until Start() is called.

Parameters
name_prefixis the thread name prefix. Every thread has a name, in the form of name_prefix/TID, for example "my_thread/321".
taskis the Closure to run in the thread.

Definition at line 12 of file closure_thread.cc.


The documentation for this class was generated from the following files: