Platform API Reference
Platform portability layer
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.
[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.
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.
}
IOT_THREAD_DEFAULT_PRIORITY
#define IOT_THREAD_DEFAULT_PRIORITY
A value representing the system default for new thread priority.
Definition: iot_platform_types.h:46
IOT_THREAD_DEFAULT_STACK_SIZE
#define IOT_THREAD_DEFAULT_STACK_SIZE
A value representhing the system default for new thread stack size.
Definition: iot_platform_types.h:53
Iot_CreateDetachedThread
bool Iot_CreateDetachedThread(IotThreadRoutine_t threadRoutine, void *pArgument, int32_t priority, size_t stackSize)
Create a new detached thread, i.e. a thread that cleans up after itself.
IotThreadRoutine_t
void(* IotThreadRoutine_t)(void *)
Thread routine function.
Definition: iot_platform_types.h:105