Contains thread-related os apis
◆ OS_CreateThread()
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
◆ OS_ExitThread()
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
◆ OS_GetTid()
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
◆ OS_RaiseException()
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
◆ OS_ResumeThread()
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
◆ OS_Sleep()
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
◆ OS_SuspendThread()
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_ThreadExitAndClear()
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
◆ OS_Yield()
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