GNU libmicrohttpd 1.0.1
|
Header for platform-independent threads abstraction. More...
Go to the source code of this file.
Data Structures | |
struct | MHD_thread_handle_struct_ |
struct | MHD_thread_ID_struct_ |
struct | _MHD_thread_handle_ID_ |
Typedefs | |
typedef struct MHD_thread_handle_struct_ | MHD_thread_handle_ |
typedef struct MHD_thread_ID_struct_ | MHD_thread_ID_ |
typedef struct _MHD_thread_handle_ID_ | MHD_thread_handle_ID_ |
typedef MHD_THRD_RTRN_TYPE_(MHD_THRD_CALL_SPEC_ * | MHD_THREAD_START_ROUTINE_) (void *cls) |
Functions | |
int | MHD_create_thread_ (MHD_thread_handle_ID_ *handle_id, size_t stack_size, MHD_THREAD_START_ROUTINE_ start_routine, void *arg) |
Header for platform-independent threads abstraction.
Provides basic abstraction for threads. Any functions can be implemented as macro on some platforms unless explicitly marked otherwise. Any function argument can be skipped in macro, so avoid variable modification in function parameters.
Definition in file mhd_threads.h.
#define MHD_create_named_thread_ | ( | t, | |
n, | |||
s, | |||
r, | |||
a ) |
Definition at line 545 of file mhd_threads.h.
#define MHD_thread_handle_get_native_ | ( | handle_var | ) |
Get native handle value from handle_var variable
Definition at line 181 of file mhd_threads.h.
#define MHD_thread_handle_ID_get_native_handle_ | ( | hndl_id | ) |
Get native thread handle from MHD_thread_handle_ID_ variable.
Definition at line 467 of file mhd_threads.h.
#define MHD_thread_handle_ID_is_current_thread_ | ( | hndl_id | ) |
Check whether provided thread ID matches current thread.
ID | thread ID to match |
Definition at line 498 of file mhd_threads.h.
Referenced by call_handlers(), cleanup_connection(), close_all_connections(), close_connection(), internal_run_from_select(), internal_suspend_connection_(), MHD_accept_connection(), MHD_cleanup_connections(), MHD_connection_close_(), MHD_connection_handle_idle(), MHD_get_timeout64(), MHD_queue_response(), MHD_suspend_connection(), new_connection_process_(), and resume_suspended_connections().
#define MHD_thread_handle_ID_is_valid_handle_ | ( | hndl_id | ) |
Check whether thread handle is valid. To be used in threads other then the thread specified by hndl_id.
Definition at line 444 of file mhd_threads.h.
Referenced by MHD_create_thread_(), MHD_get_daemon_info(), MHD_run_wait(), and MHD_stop_daemon().
#define MHD_thread_handle_ID_is_valid_ID_ | ( | hndl_id | ) |
Check whether thread ID is valid. To be used in the thread itself.
Definition at line 474 of file mhd_threads.h.
Referenced by call_handlers(), and internal_run_from_select().
#define MHD_thread_handle_ID_join_thread_ | ( | hndl_id | ) |
Wait until specified thread is ended and free thread handle on success.
hndl_id_ | handle with ID to watch |
Definition at line 506 of file mhd_threads.h.
Referenced by close_all_connections(), MHD_cleanup_connections(), and MHD_stop_daemon().
#define MHD_thread_handle_ID_set_current_thread_ID_ | ( | hndl_id_ptr | ) |
Set current thread ID in the variable pointed by hndl_id_ptr
Definition at line 489 of file mhd_threads.h.
#define MHD_thread_handle_ID_set_invalid_ | ( | hndl_id_ptr | ) |
Set MHD_thread_handle_ID_ to invalid value
Definition at line 436 of file mhd_threads.h.
Referenced by MHD_create_thread_(), MHD_start_daemon_va(), and new_connection_prepare_().
#define MHD_thread_handle_ID_set_native_handle_ | ( | hndl_id_ptr, | |
native_val ) |
Set native handle in variable pointed by hndl_id_ptr to native_val value
Definition at line 451 of file mhd_threads.h.
Referenced by MHD_create_thread_().
#define MHD_thread_handle_is_valid_ | ( | handle_var | ) |
Check whether native handle value is set in handle_var variable
Definition at line 176 of file mhd_threads.h.
#define MHD_thread_handle_set_invalid_ | ( | handle_ptr | ) |
Set variable pointed by handle_ptr to invalid (unset) value
Definition at line 165 of file mhd_threads.h.
#define MHD_thread_handle_set_native_ | ( | handle_ptr, | |
native_val ) |
Set native handle in variable pointed by handle_ptr to native_val value
Definition at line 171 of file mhd_threads.h.
#define MHD_thread_ID_get_native_ | ( | ID_var | ) |
Get native ID value from ID_var variable
Definition at line 316 of file mhd_threads.h.
#define MHD_thread_ID_is_current_thread_ | ( | ID_var | ) |
Check whether ID_var variable is equal current thread
Definition at line 321 of file mhd_threads.h.
#define MHD_thread_ID_is_valid_ | ( | ID_var | ) |
Check whether native ID value is set in ID_var variable
Definition at line 311 of file mhd_threads.h.
#define MHD_thread_ID_native_is_current_thread_ | ( | id | ) |
Check whether specified thread ID matches current thread.
id | the thread ID to match |
Definition at line 263 of file mhd_threads.h.
#define MHD_thread_ID_set_current_thread_ | ( | ID_ptr | ) |
Set current thread ID in variable pointed by ID_ptr
Definition at line 361 of file mhd_threads.h.
#define MHD_thread_ID_set_invalid_ | ( | ID_ptr | ) |
Set variable pointed by ID_ptr to invalid (unset) value
Definition at line 300 of file mhd_threads.h.
#define MHD_thread_ID_set_native_ | ( | ID_ptr, | |
native_val ) |
Set native ID in variable pointed by ID_ptr to native_val value
Definition at line 306 of file mhd_threads.h.
typedef struct MHD_thread_handle_struct_ MHD_thread_handle_ |
Type with thread handle that can be set to invalid value
Definition at line 160 of file mhd_threads.h.
typedef struct _MHD_thread_handle_ID_ MHD_thread_handle_ID_ |
Definition at line 426 of file mhd_threads.h.
typedef struct MHD_thread_ID_struct_ MHD_thread_ID_ |
Type with thread ID that can be set to invalid value
Definition at line 295 of file mhd_threads.h.
typedef MHD_THRD_RTRN_TYPE_(MHD_THRD_CALL_SPEC_ * MHD_THREAD_START_ROUTINE_) (void *cls) |
Signature of main function for a thread.
cls | closure argument for the function |
Definition at line 523 of file mhd_threads.h.
int MHD_create_thread_ | ( | MHD_thread_handle_ID_ * | handle_id, |
size_t | stack_size, | ||
MHD_THREAD_START_ROUTINE_ | start_routine, | ||
void * | arg ) |
Create a thread and set the attributes according to our options.
If thread is created, thread handle must be freed by MHD_join_thread_().
handle_id | handle to initialise |
stack_size | size of stack for new thread, 0 for default |
start_routine | main function of thread |
arg | argument for start_routine |
Create a thread and set the attributes according to our options.
thread | handle to initialize |
stack_size | size of stack for new thread, 0 for default |
start_routine | main function of thread |
arg | argument for start_routine |
Definition at line 180 of file mhd_threads.c.
References _MHD_thread_handle_ID_::handle, mhd_assert, MHD_thread_handle_ID_is_valid_handle_, MHD_thread_handle_ID_set_invalid_, MHD_thread_handle_ID_set_native_handle_, NULL, and UINT_MAX.