IoT managed integrations End Device SDK
Loading...
Searching...
No Matches
Typedefs | Enumerations | Functions
iotmi_pal_Thread.h File Reference

This file defines thread functions platform abstraction interface. More...

#include <stdint.h>

Go to the source code of this file.

Typedefs

typedef struct iotmiPal_ThreadStruct iotmiPal_ThreadStruct_t
 
typedef struct iotmiPal_ThreadStruct * iotmiPal_ThreadHandle_t
 
typedef void(* iotmiPal_ThreadFunction_t) (void *pParam)
 Thread function to be executed in the created thread.
 
typedef enum iotmiPal_ThreadType iotmiPal_ThreadType_t
 Thread type to be created.
 

Enumerations

enum  iotmiPal_ThreadType {
  IOTMI_PAL_THREAD_URGENT = 0 , IOTMI_PAL_THREAD_NORMAL , IOTMI_PAL_THREAD_BACKGROUND , IOTMI_PAL_THREAD_MQTT_AGENT ,
  IOTMI_PAL_THREAD_DATA_MODEL_HANDLER , IOTMI_PAL_THREAD_JOB_HANDLER , IOTMI_PAL_THREAD_MISC
}
 Thread type to be created.
 

Functions

iotmiPal_ThreadHandle_t iotmiPal_threadCreate (const char *pThreadname, iotmiPal_ThreadType_t threadType, iotmiPal_ThreadFunction_t threadFunc, void *pParam)
 Create thread function.
 
int iotmiPal_threadJoin (iotmiPal_ThreadHandle_t threadHandle)
 Thread join function.
 
void iotmiPal_threadSleepMs (uint32_t sleepTimeMs)
 Millisecond sleep function.
 

Detailed Description

This file defines thread functions platform abstraction interface.

Typedef Documentation

◆ iotmiPal_ThreadFunction_t

typedef void(* iotmiPal_ThreadFunction_t) (void *pParam)

Thread function to be executed in the created thread.

Parameters
[in]pParamThe pParam parameter passed in iotmiPal_threadCreate function.

Function Documentation

◆ iotmiPal_threadCreate()

iotmiPal_ThreadHandle_t iotmiPal_threadCreate ( const char *  pThreadname,
iotmiPal_ThreadType_t  threadType,
iotmiPal_ThreadFunction_t  threadFunc,
void *  pParam 
)

Create thread function.

Parameters
[in]pThreadnameThe thread name of the created thread function.
[in]threadTypeThe thread type of the created thread. Stack priority and stack size can be set accordingly.
[in]threadFuncThe thread function to run for the created thread.
[in]pParamThe pParam parameter passed in iotmiPal_ThreadFunction_t function.
Returns
The thread handle of the created thread when success. Otherwise, return NULL to indicate error.

◆ iotmiPal_threadJoin()

int iotmiPal_threadJoin ( iotmiPal_ThreadHandle_t  threadHandle)

Thread join function.

Parameters
[in]threadHandleThe thread handle of the thread to be waited.
Returns
Return zero when success. Otherwise, return negative value to indicate error.

◆ iotmiPal_threadSleepMs()

void iotmiPal_threadSleepMs ( uint32_t  sleepTimeMs)

Millisecond sleep function.

Parameters
[in]sleepTimeMsmilliseconds to sleep.