threads.h
More...
Detailed Description
Contains thread-related os apis
Function Documentation
OS_RETURN_CODE OS_CreateThread |
( |
VOID(*)(VOID *) |
ThreadMainFunction, |
|
|
VOID * |
ThreadParam, |
|
|
VOID * |
stackBottom, |
|
|
ADDRINT |
stackSize, |
|
|
NATIVE_TID * |
td |
|
) |
| |
Create a new thread in the current process.
- Parameters:
-
[in] | ThreadMainFunction | Thread start address |
[in] | ThreadParam | Thread optional parameter |
[in] | stackBottom | The base address of the thread's stack. This argument can be NULL. In that case this function will allocate the stack according to the stackSize argument. |
[in] | stackSize | The size of the thread's stack. |
[out] | td | The descriptor of newly created thread. |
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_THREAD_CREATE_FAILED | If the operation Failed |
- Returns:
- Operation status code.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
Causes a running thread to exit.
- Parameters:
-
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_THREAD_EXIT_FAILED | If the operation Failed |
- Returns:
- Operation status code.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
Retrieves the current thread's handle.
- Parameters:
-
[out] | id | Address of handle container variable |
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_THREAD_QUERY_FAILED | If the operation Failed |
- Returns:
- Operation status code.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
Raise an exception.
- Parameters:
-
[in] | td | Thread descriptor |
[in] | code | Exception type |
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_THREAD_SLEEP_FAILED | If the operation Failed |
- Returns:
- Operation status code.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
Resumes running thread.
- Parameters:
-
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_THREAD_RESUME_FAILED | If the operation Failed |
- Returns:
- Operation status code.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
Sends thread to sleep.
- Parameters:
-
[in] | interval | Interval to sleep in milli-seconds. |
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_THREAD_SLEEP_FAILED | If the operation Failed |
- Returns:
- Operation status code.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
Suspends a running thread.
- Parameters:
-
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_THREAD_SUSPEND_FAILED | If the operation Failed |
- Returns:
- Operation status code.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All
OS_RETURN_CODE OS_ThreadExitAndClear |
( |
void * |
stackAddr, |
|
|
ADDRINT |
stackSize, |
|
|
INT32 * |
dwordToReset |
|
) |
| |
This function clears a word and then exits the calling thread. It guaranteess that it will use only register state (no memory) once word is cleared.
- Parameters:
-
[in] | code | The thread exit code as passed from the caller |
[out] | dwordToReset | This memory location is cleared (set to zero). |
- Return values:
-
OS_RETURN_CODE_THREAD_EXIT_FAILED | If the operation Failed |
- Returns:
- Operation status code.
- Availability:
- O/S: Linux & macOS*
CPU: All
Pre-empts the thread specified by the running thread.
- Return values:
-
OS_RETURN_CODE_NO_ERROR | If the operation succeeded |
OS_RETURN_CODE_THREAD_SLEEP_FAILED | If the operation Failed |
- Returns:
- Operation status code.
- Availability:
- O/S: Windows, Linux & macOS*
CPU: All