Task Pool API Reference
Task pool library
iot_taskpool_types.h File Reference

Types of the task pool. More...

#include "iot_config.h"
#include <stdbool.h>
#include <stdint.h>
#include "types/iot_platform_types.h"
#include "iot_linear_containers.h"

Go to the source code of this file.

Data Structures

struct  IotTaskPoolJobStorage_t
 The job storage data structure provides the storage for a statically allocated Task Pool Job instance. More...
 
struct  IotTaskPoolInfo_t
 Initialization information to create one task pool instance. More...
 

Macros

#define IOT_TASKPOOL_INFO_INITIALIZER_SMALL   { .minThreads = 1, .maxThreads = 1, .stackSize = IOT_THREAD_DEFAULT_STACK_SIZE, .priority = IOT_THREAD_DEFAULT_PRIORITY }
 Initializer for a small IotTaskPoolInfo_t.
 
#define IOT_TASKPOOL_INFO_INITIALIZER_MEDIUM   { .minThreads = 1, .maxThreads = 2, .stackSize = IOT_THREAD_DEFAULT_STACK_SIZE, .priority = IOT_THREAD_DEFAULT_PRIORITY }
 Initializer for a medium IotTaskPoolInfo_t.
 
#define IOT_TASKPOOL_INFO_INITIALIZER_LARGE   { .minThreads = 2, .maxThreads = 3, .stackSize = IOT_THREAD_DEFAULT_STACK_SIZE, .priority = IOT_THREAD_DEFAULT_PRIORITY }
 Initializer for a large IotTaskPoolInfo_t.
 
#define IOT_TASKPOOL_INFO_INITIALIZER_XLARGE   { .minThreads = 2, .maxThreads = 4, .stackSize = IOT_THREAD_DEFAULT_STACK_SIZE, .priority = IOT_THREAD_DEFAULT_PRIORITY }
 Initializer for a very large IotTaskPoolInfo_t.
 
#define IOT_TASKPOOL_INFO_INITIALIZER   IOT_TASKPOOL_INFO_INITIALIZER_MEDIUM
 Initializer for a typical IotTaskPoolInfo_t.
 
#define IOT_TASKPOOL_INITIALIZER   NULL
 Initializer for a IotTaskPool_t.
 
#define IOT_TASKPOOL_JOB_STORAGE_INITIALIZER   { { NULL, NULL }, NULL, NULL, 0, IOT_TASKPOOL_STATUS_UNDEFINED }
 Initializer for a IotTaskPoolJobStorage_t.
 
#define IOT_TASKPOOL_JOB_INITIALIZER   NULL
 Initializer for a IotTaskPoolJob_t.
 
#define IOT_TASKPOOL_JOB_HIGH_PRIORITY   ( ( uint32_t ) 0x00000001 )
 Flag for scheduling a job to execute immediately, even if the maximum number of threads in the task pool was reached already. More...
 
#define IOT_SYSTEM_TASKPOOL   ( NULL )
 Allows the use of the system task pool. More...
 

Typedefs

typedef struct _taskPool * IotTaskPool_t
 Opaque handle of a Task Pool instance. More...
 
typedef struct _taskPoolJob * IotTaskPoolJob_t
 Opaque handle of a Task Pool Job. More...
 
typedef void(* IotTaskPoolRoutine_t) (IotTaskPool_t pTaskPool, IotTaskPoolJob_t pJob, void *pUserContext)
 Callback type for a user callback. More...
 

Enumerations

enum  IotTaskPoolError_t {
  IOT_TASKPOOL_SUCCESS = 0, IOT_TASKPOOL_BAD_PARAMETER, IOT_TASKPOOL_ILLEGAL_OPERATION, IOT_TASKPOOL_NO_MEMORY,
  IOT_TASKPOOL_SHUTDOWN_IN_PROGRESS, IOT_TASKPOOL_CANCEL_FAILED
}
 Return codes of task pool functions. More...
 
enum  IotTaskPoolJobStatus_t {
  IOT_TASKPOOL_STATUS_READY = 0, IOT_TASKPOOL_STATUS_SCHEDULED, IOT_TASKPOOL_STATUS_DEFERRED, IOT_TASKPOOL_STATUS_COMPLETED,
  IOT_TASKPOOL_STATUS_CANCELED, IOT_TASKPOOL_STATUS_UNDEFINED
}
 Status codes of task pool Job. More...
 

Detailed Description

Types of the task pool.

Macro Definition Documentation

◆ IOT_TASKPOOL_JOB_HIGH_PRIORITY

#define IOT_TASKPOOL_JOB_HIGH_PRIORITY   ( ( uint32_t ) 0x00000001 )

Flag for scheduling a job to execute immediately, even if the maximum number of threads in the task pool was reached already.

Warning
This flag may cause the task pool to create a worker to serve the job immediately, and therefore using this flag may incur in additional memory usage and potentially fail scheduling the job.

◆ IOT_SYSTEM_TASKPOOL

#define IOT_SYSTEM_TASKPOOL   ( NULL )

Allows the use of the system task pool.

Warning
The system task pool handle is not valid unless IotTaskPool_CreateSystemTaskPool is called before the handle is used.