AWS IoT Device SDK C: Platform
Platform portability layer
Return to main page ↑
Iot_CreateDetachedThread

Create a new detached thread, i.e. a thread that cleans up after itself.

void * pArgument,
int32_t priority,
size_t stackSize );

This function creates a new thread. Threads created by this function exit upon returning from the thread routine. Any resources taken must be freed by the exiting thread.

Parameters
[in]threadRoutineThe function this thread should run.
[in]pArgumentThe argument passed to threadRoutine.
[in]priorityRepresents the priority of the new thread, as defined by the system. The value IOT_THREAD_DEFAULT_PRIORITY (i.e. 0) must be used to represent the system default for thread priority. IOT_THREAD_IGNORE_PRIORITY should be passed if this parameter is not relevant for the port implementation.
[in]stackSizeRepresents the stack size of the new thread, as defined by the system. The value IOT_THREAD_DEFAULT_STACK_SIZE (i.e. 0) must be used to represent the system default for stack size. IOT_THREAD_IGNORE_STACK_SIZE should be passed if this parameter is not relevant for the port implementation.
Returns
true if the new thread was successfully created; false otherwise.
// Thread routine.
void threadRoutine( void * pArgument );
// Run threadRoutine in a detached thread, using default priority and stack size.
if( Iot_CreateDetachedThread( threadRoutine,
NULL,
{
// Success
}
else
{
// Failure, no thread was created.
}