Task Pool API Reference
Task pool library
This function schedules a job created with IotTaskPool_CreateJob or IotTaskPool_CreateRecyclableJob against the task pool pointed to by taskPool
.
See Design for a description of the jobs lifetime and interaction with the threads used in the task pool library.
Parameters
[in] taskPool A handle to the task pool that must have been previously initialized with. a call to IotTaskPool_Create .
[in] job A job to schedule for execution. This must be first initialized with a call to IotTaskPool_CreateJob .
[in] flags Flags to be passed by the user, e.g. to identify the job as high priority by specifying IOT_TASKPOOL_JOB_HIGH_PRIORITY .
Returns One of the following:
Note This function will not allocate memory, so it is guaranteed to succeed if the paramters are correct and the task pool was correctly initialized, and not yet destroyed.
Warning The taskPool
used in this function should be the same used to create the job pointed to by job
, or the results will be undefined.
Example
typedef struct JobUserContext
{
uint32_t counter;
} JobUserContext_t;
{
( void )taskPool;
( void )job;
JobUserContext_t * pUserContext = ( JobUserContext_t * )context;
pUserContext->counter++;
}
void TaskPoolExample( )
{
JobUserContext_t userContext = { 0 };
switch ( errorSchedule )
{
break ;
break ;
default :
}
}
Task pool operation failed because of an invalid parameter.
Definition: iot_taskpool_types.h:135
Task pool operation failed because at least one parameter is invalid.
Definition: iot_taskpool_types.h:90
struct _taskPool * IotTaskPool_t
Opaque handle of a Task Pool instance.
Definition: iot_taskpool_types.h:213
Task pool operation failed because it is illegal.
Definition: iot_taskpool_types.h:105
Initialization information to create one task pool instance.
Definition: iot_taskpool_types.h:273
IotTaskPoolError_t IotTaskPool_Create(const IotTaskPoolInfo_t *const pInfo, IotTaskPool_t *const pTaskPool)
Creates one instance of a task pool.
Task pool operation completed successfully.
Definition: iot_taskpool_types.h:70
Task pool operation failed because allocating memory failed.
Definition: iot_taskpool_types.h:119
IotTaskPoolError_t IotTaskPool_CreateJob(IotTaskPoolRoutine_t userCallback, void *pUserContext, IotTaskPoolJobStorage_t *const pJobStorage, IotTaskPoolJob_t *const pJob)
Creates a job for the task pool around a user-provided storage.
Definition: iot_taskpool.c:281
uint32_t minThreads
Specifies the operating parameters for a task pool.
Definition: iot_taskpool_types.h:284
IotTaskPoolError_t
Return codes of task pool functions.
Definition: iot_taskpool_types.h:50
IotTaskPoolError_t IotTaskPool_Schedule(IotTaskPool_t taskPool, IotTaskPoolJob_t job, uint32_t flags)
This function schedules a job created with IotTaskPool_CreateJob or IotTaskPool_CreateRecyclableJob a...
Definition: iot_taskpool.c:414
struct _taskPoolJob * IotTaskPoolJob_t
Opaque handle of a Task Pool Job.
Definition: iot_taskpool_types.h:246
IotTaskPoolError_t IotTaskPool_Destroy(IotTaskPool_t taskPool)
Destroys a task pool instance and collects all memory associated with a task pool and its satellite d...