#include "mercury_util_config.h"
#include <pthread.h>
Go to the source code of this file.
typedef void*(* hg_thread_func_t)(void *) |
HG_UTIL_EXPORT void hg_thread_init |
( |
hg_thread_t * |
thread | ) |
|
Initialize the thread.
- Parameters
-
thread | [IN/OUT] pointer to thread object |
Create a new thread for the given function.
- Parameters
-
thread | [IN/OUT] pointer to thread object |
f | [IN] pointer to function |
data | [IN] pointer to data than be passed to function f |
- Returns
- Non-negative on success or negative on failure
Ends the calling thread.
- Parameters
-
ret | [IN] exit code for the thread |
- Returns
- Non-negative on success or negative on failure
HG_UTIL_EXPORT int hg_thread_join |
( |
hg_thread_t |
thread | ) |
|
Wait for thread completion.
- Parameters
-
- Returns
- Non-negative on success or negative on failure
HG_UTIL_EXPORT int hg_thread_cancel |
( |
hg_thread_t |
thread | ) |
|
Terminate the thread.
- Parameters
-
- Returns
- Non-negative on success or negative on failure
Create a thread-specific data key visible to all threads in the process.
- Parameters
-
key | [OUT] pointer to thread key object |
- Returns
- Non-negative on success or negative on failure
Delete a thread-specific data key previously returned by hg_thread_key_create().
- Parameters
-
key | [IN] thread key object |
- Returns
- Non-negative on success or negative on failure
Get value from specified key.
- Parameters
-
key | [IN] thread key object |
- Returns
- Pointer to data associated to the key
HG_UTIL_EXPORT int hg_thread_setspecific |
( |
hg_thread_key_t |
key, |
|
|
const void * |
value |
|
) |
| |
Set value to specified key.
- Parameters
-
key | [IN] thread key object |
value | [IN] pointer to data that will be associated |
- Returns
- Non-negative on success or negative on failure