Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of azure_c_shared_utility by
threadapi.h File Reference
This module implements support for creating new threads, terminating threads and sleeping threads. More...
Go to the source code of this file.
Functions | |
DEFINE_ENUM (THREADAPI_RESULT, THREADAPI_RESULT_VALUES) | |
Enumeration specifying the possible return values for the APIs in this module. | |
MOCKABLE_FUNCTION (, THREADAPI_RESULT, ThreadAPI_Create, THREAD_HANDLE *, threadHandle, THREAD_START_FUNC, func, void *, arg) | |
Creates a thread with the entry point specified by the func argument. | |
MOCKABLE_FUNCTION (, THREADAPI_RESULT, ThreadAPI_Join, THREAD_HANDLE, threadHandle, int *, res) | |
Blocks the calling thread by waiting on the thread identified by the threadHandle argument to complete. | |
MOCKABLE_FUNCTION (, void, ThreadAPI_Exit, int, res) | |
This function is called by a thread when the thread exits. | |
MOCKABLE_FUNCTION (, void, ThreadAPI_Sleep, unsigned int, milliseconds) | |
Sleeps the current thread for the given number of milliseconds. |
Detailed Description
This module implements support for creating new threads, terminating threads and sleeping threads.
Definition in file threadapi.h.
Function Documentation
DEFINE_ENUM | ( | THREADAPI_RESULT | , |
THREADAPI_RESULT_VALUES | |||
) |
Enumeration specifying the possible return values for the APIs in this module.
MOCKABLE_FUNCTION | ( | void | , |
ThreadAPI_Sleep | , | ||
unsigned | int, | ||
milliseconds | |||
) |
Sleeps the current thread for the given number of milliseconds.
- Parameters:
-
milliseconds The number of milliseconds to sleep.
MOCKABLE_FUNCTION | ( | void | , |
ThreadAPI_Exit | , | ||
int | , | ||
res | |||
) |
This function is called by a thread when the thread exits.
- Parameters:
-
res An integer that represents the exit status of the thread.
This function is called by a thread when the thread exits in order to return a result value to the caller of the ThreadAPI_Join function. The res
value must be copied into the res
out argument passed to the ThreadAPI_Join function.
MOCKABLE_FUNCTION | ( | THREADAPI_RESULT | , |
ThreadAPI_Join | , | ||
THREAD_HANDLE | , | ||
threadHandle | , | ||
int * | , | ||
res | |||
) |
Blocks the calling thread by waiting on the thread identified by the threadHandle
argument to complete.
- Parameters:
-
threadHandle The handle of the thread to wait for completion. res The result returned by the thread which is passed to the ThreadAPI_Exit function.
When the threadHandle
thread completes, all resources associated with the thread must be released and the thread handle will no longer be valid.
- Returns:
THREADAPI_OK
if the API call is successful or an error code in case it fails.
MOCKABLE_FUNCTION | ( | THREADAPI_RESULT | , |
ThreadAPI_Create | , | ||
THREAD_HANDLE * | , | ||
threadHandle | , | ||
THREAD_START_FUNC | , | ||
func | , | ||
void * | , | ||
arg | |||
) |
Creates a thread with the entry point specified by the func
argument.
- Parameters:
-
threadHandle The handle to the new thread is returned in this pointer. func A function pointer that indicates the entry point to the new thread. arg A void pointer that must be passed to the function pointed to by func
.
- Returns:
THREADAPI_OK
if the API call is successful or an error code in case it fails.
Generated on Tue Jul 12 2022 19:14:38 by
