GRPC Core  5.0.0
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
thd.h
Go to the documentation of this file.
1 /*
2  *
3  * Copyright 2015 gRPC authors.
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18 
19 #ifndef GRPC_SUPPORT_THD_H
20 #define GRPC_SUPPORT_THD_H
21 
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35 
36 typedef uintptr_t gpr_thd_id;
37 
39 typedef struct {
40  int flags;
42 
47 GPRAPI int gpr_thd_new(gpr_thd_id* t, void (*thd_body)(void* arg), void* arg,
48  const gpr_thd_options* options);
49 
52 
55 
58 
61 
64 
66 GPRAPI gpr_thd_id gpr_thd_currentid(void);
67 
70 GPRAPI void gpr_thd_join(gpr_thd_id t);
71 
72 #ifdef __cplusplus
73 }
74 #endif
75 
76 #endif /* GRPC_SUPPORT_THD_H */
GPRAPI gpr_thd_options gpr_thd_options_default(void)
Return a gpr_thd_options struct with all fields set to defaults.
#define GPRAPI
Definition: port_platform.h:440
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.
int flags
Definition: thd.h:40
GPRAPI void gpr_thd_options_set_detached(gpr_thd_options *options)
Set the thread to become detached on startup - this is the default.
GPRAPI gpr_thd_id gpr_thd_currentid(void)
Returns the identifier of the current thread.
uintptr_t gpr_thd_id
Thread interface for GPR.
Definition: thd.h:36
GPRAPI void gpr_thd_options_set_joinable(gpr_thd_options *options)
Set the thread to become joinable - mutually exclusive with detached.
GPRAPI void gpr_thd_join(gpr_thd_id t)
Blocks until the specified thread properly terminates.
GPRAPI int gpr_thd_options_is_detached(const gpr_thd_options *options)
Returns non-zero if the option detached is set.
Thread creation options.
Definition: thd.h:39
GPRAPI int gpr_thd_options_is_joinable(const gpr_thd_options *options)
Returns non-zero if the option joinable is set.