GRPC Core  4.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Typedefs | Functions
thd.h File Reference
#include <grpc/support/port_platform.h>

Go to the source code of this file.

Data Structures

struct  gpr_thd_options
 Thread creation options. More...
 

Typedefs

typedef uintptr_t gpr_thd_id
 Thread interface for GPR. More...
 

Functions

GPRAPI int gpr_thd_new (gpr_thd_id *t, void(*thd_body)(void *arg), void *arg, const gpr_thd_options *options)
 Create a new thread running (*thd_body)(arg) and place its thread identifier in *t, and return true. More...
 
GPRAPI gpr_thd_options gpr_thd_options_default (void)
 Return a gpr_thd_options struct with all fields set to defaults. More...
 
GPRAPI void gpr_thd_options_set_detached (gpr_thd_options *options)
 Set the thread to become detached on startup - this is the default. More...
 
GPRAPI void gpr_thd_options_set_joinable (gpr_thd_options *options)
 Set the thread to become joinable - mutually exclusive with detached. More...
 
GPRAPI int gpr_thd_options_is_detached (const gpr_thd_options *options)
 Returns non-zero if the option detached is set. More...
 
GPRAPI int gpr_thd_options_is_joinable (const gpr_thd_options *options)
 Returns non-zero if the option joinable is set. More...
 
GPRAPI gpr_thd_id gpr_thd_currentid (void)
 Returns the identifier of the current thread. More...
 
GPRAPI void gpr_thd_join (gpr_thd_id t)
 Blocks until the specified thread properly terminates. More...
 

Typedef Documentation

typedef uintptr_t gpr_thd_id

Thread interface for GPR.

Types gpr_thd_id a thread identifier. (Currently no calls take a thread identifier. It exists for future extensibility.) gpr_thd_options options used when creating a thread

Function Documentation

GPRAPI gpr_thd_id gpr_thd_currentid ( void  )

Returns the identifier of the current thread.

GPRAPI void gpr_thd_join ( gpr_thd_id  t)

Blocks until the specified thread properly terminates.

Calling this on a detached thread has unpredictable results.

GPRAPI int gpr_thd_new ( gpr_thd_id t,
void(*)(void *arg)  thd_body,
void *  arg,
const gpr_thd_options options 
)

Create a new thread running (*thd_body)(arg) and place its thread identifier in *t, and return true.

If there are insufficient resources, return false. If options==NULL, default options are used. The thread is immediately runnable, and exits when (*thd_body)() returns.

GPRAPI gpr_thd_options gpr_thd_options_default ( void  )

Return a gpr_thd_options struct with all fields set to defaults.

GPRAPI int gpr_thd_options_is_detached ( const gpr_thd_options options)

Returns non-zero if the option detached is set.

GPRAPI int gpr_thd_options_is_joinable ( const gpr_thd_options options)

Returns non-zero if the option joinable is set.

GPRAPI void gpr_thd_options_set_detached ( gpr_thd_options options)

Set the thread to become detached on startup - this is the default.

GPRAPI void gpr_thd_options_set_joinable ( gpr_thd_options options)

Set the thread to become joinable - mutually exclusive with detached.