Classes | Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
grpc_core::Thread Class Reference

#include <thd.h>

Classes

class  Options
 

Public Member Functions

void Join ()
 
Threadoperator= (Thread &&other) noexcept
 
void Start ()
 
 Thread ()
 
 Thread (const char *thd_name, void(*thd_body)(void *arg), void *arg, bool *success=nullptr, const Options &options=Options())
 
 Thread (Thread &&other) noexcept
 
 ~Thread ()
 

Private Types

enum  ThreadState {
  FAKE, ALIVE, STARTED, DONE,
  FAILED, MOVED
}
 

Private Member Functions

Threadoperator= (const Thread &)=delete
 
 Thread (const Thread &)=delete
 

Private Attributes

internal::ThreadInternalsInterfaceimpl_
 
Options options_
 
ThreadState state_
 

Detailed Description

Definition at line 43 of file thd.h.

Member Enumeration Documentation

◆ ThreadState

The thread states are as follows: FAKE – just a phony placeholder Thread created by the default constructor ALIVE – an actual thread of control exists associated with this thread STARTED – the thread of control has been started DONE – the thread of control has completed and been joined FAILED – the thread of control never came alive MOVED – contents were moved out and we're no longer tracking them

Enumerator
FAKE 
ALIVE 
STARTED 
DONE 
FAILED 
MOVED 

Definition at line 163 of file thd.h.

Constructor & Destructor Documentation

◆ Thread() [1/4]

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_

Definition at line 78 of file thd.h.

◆ Thread() [2/4]

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/4]

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

Definition at line 91 of file thd.h.

◆ ~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.

Definition at line 123 of file thd.h.

◆ Thread() [4/4]

grpc_core::Thread::Thread ( const Thread )
privatedelete

Member Function Documentation

◆ Join()

void grpc_core::Thread::Join ( )
inline

Definition at line 141 of file thd.h.

◆ operator=() [1/2]

Thread& grpc_core::Thread::operator= ( const Thread )
privatedelete

◆ operator=() [2/2]

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

Definition at line 101 of file thd.h.

◆ Start()

void grpc_core::Thread::Start ( )
inline

Definition at line 125 of file thd.h.

Member Data Documentation

◆ impl_

internal::ThreadInternalsInterface* grpc_core::Thread::impl_
private

Definition at line 165 of file thd.h.

◆ options_

Options grpc_core::Thread::options_
private

Definition at line 166 of file thd.h.

◆ state_

ThreadState grpc_core::Thread::state_
private

Definition at line 164 of file thd.h.


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


grpc
Author(s):
autogenerated on Fri May 16 2025 03:03:37