GRPC C++  1.39.1
Data Structures | Public Member Functions
grpc_core::Thread Class Reference

#include <thd.h>

Data Structures

class  Options
 

Public Member Functions

 Thread ()
 Default constructor only to allow use in structs that lack constructors Does not produce a validly-constructed thread; must later use placement new to construct a real thread. More...
 
 Thread (const char *thd_name, void(*thd_body)(void *arg), void *arg, bool *success=nullptr, const Options &options=Options())
 Normal constructor to create a thread with name thd_name, which will execute a thread based on function thd_body with argument arg once it is started. More...
 
 Thread (Thread &&other) noexcept
 Move constructor for thread. More...
 
Threadoperator= (Thread &&other) noexcept
 Move assignment operator for thread. More...
 
 ~Thread ()
 The destructor is strictly optional; either the thread never came to life and the constructor itself killed it, or it has already been joined and the Join function kills it, or it was detached (non-joinable) and it has run to completion and is now killing itself. More...
 
void Start ()
 
void Join ()
 

Constructor & Destructor Documentation

◆ Thread() [1/3]

grpc_core::Thread::Thread ( )
inline

Default constructor only to allow use in structs that lack constructors Does not produce a validly-constructed thread; must later use placement new to construct a real thread.

Does not init mu_ and cv_

◆ Thread() [2/3]

grpc_core::Thread::Thread ( const char *  thd_name,
void(*)(void *arg)  thd_body,
void *  arg,
bool *  success = nullptr,
const Options options = Options() 
)

Normal constructor to create a thread with name thd_name, which will execute a thread based on function thd_body with argument arg once it is started.

The optional success argument indicates whether the thread is successfully created. The optional options can be used to set the thread detachable.

◆ Thread() [3/3]

grpc_core::Thread::Thread ( Thread &&  other)
inlinenoexcept

Move constructor for thread.

After this is called, the other thread no longer represents a living thread object

◆ ~Thread()

grpc_core::Thread::~Thread ( )
inline

The destructor is strictly optional; either the thread never came to life and the constructor itself killed it, or it has already been joined and the Join function kills it, or it was detached (non-joinable) and it has run to completion and is now killing itself.

The destructor shouldn't have to do anything.

Member Function Documentation

◆ Join()

void grpc_core::Thread::Join ( )
inline

◆ operator=()

Thread& grpc_core::Thread::operator= ( Thread &&  other)
inlinenoexcept

Move assignment operator for thread.

After this is called, the other thread no longer represents a living thread object. Not allowed if this thread actually exists

◆ Start()

void grpc_core::Thread::Start ( )
inline

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