AWS IoT Device SDK C: Task Pool
Task pool library
Return to main page ↑
iot_taskpool_types.h
Go to the documentation of this file.
1 /*
2  * IoT Common V1.1.0
3  * Copyright (C) 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a copy of
6  * this software and associated documentation files (the "Software"), to deal in
7  * the Software without restriction, including without limitation the rights to
8  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
9  * the Software, and to permit persons to whom the Software is furnished to do so,
10  * subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in all
13  * copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
17  * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
18  * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
19  * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
20  * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
21  */
22 
28 #ifndef IOT_TASKPOOL_TYPES_H_
29 #define IOT_TASKPOOL_TYPES_H_
30 
31 /* The config header is always included first. */
32 #include "iot_config.h"
33 
34 /* Standard includes. */
35 #include <stdbool.h>
36 #include <stdint.h>
37 
38 /* Platform types includes. */
40 
41 /* Linear containers (lists and queues) include. */
42 #include "iot_linear_containers.h"
43 
44 /*-------------------------- Task pool enumerated types --------------------------*/
45 
50 typedef enum IotTaskPoolError
51 {
56 
61 
66 
71 
76 
81 
87 
97 typedef enum IotTaskPoolJobStatus
98 {
135 
136 /*------------------------- Task pool types and handles --------------------------*/
137 
154 typedef struct _taskPool * IotTaskPool_t;
155 
164 typedef struct IotTaskPoolJobStorage
165 {
166  IotLink_t link;
167  void * dummy2;
168  void * dummy3;
169  uint32_t dummy4;
187 typedef struct _taskPoolJob * IotTaskPoolJob_t;
188 
189 /*------------------------- Task pool parameter structs --------------------------*/
200 typedef void ( * IotTaskPoolRoutine_t )( IotTaskPool_t pTaskPool,
201  IotTaskPoolJob_t pJob,
202  void * pUserContext );
214 typedef struct IotTaskPoolInfo
215 {
225  uint32_t minThreads;
226  uint32_t maxThreads;
227  uint32_t stackSize;
228  int32_t priority;
231 /*------------------------- TASKPOOL defined constants --------------------------*/
264 /* @[define_taskpool_initializers] */
266 #define IOT_TASKPOOL_INFO_INITIALIZER_SMALL { .minThreads = 1, .maxThreads = 1, .stackSize = IOT_THREAD_DEFAULT_STACK_SIZE, .priority = IOT_THREAD_DEFAULT_PRIORITY }
267 
268 #define IOT_TASKPOOL_INFO_INITIALIZER_MEDIUM { .minThreads = 1, .maxThreads = 2, .stackSize = IOT_THREAD_DEFAULT_STACK_SIZE, .priority = IOT_THREAD_DEFAULT_PRIORITY }
269 
270 #define IOT_TASKPOOL_INFO_INITIALIZER_LARGE { .minThreads = 2, .maxThreads = 3, .stackSize = IOT_THREAD_DEFAULT_STACK_SIZE, .priority = IOT_THREAD_DEFAULT_PRIORITY }
271 
272 #define IOT_TASKPOOL_INFO_INITIALIZER_XLARGE { .minThreads = 2, .maxThreads = 4, .stackSize = IOT_THREAD_DEFAULT_STACK_SIZE, .priority = IOT_THREAD_DEFAULT_PRIORITY }
273 
274 #define IOT_TASKPOOL_INFO_INITIALIZER IOT_TASKPOOL_INFO_INITIALIZER_MEDIUM
275 
276 #define IOT_TASKPOOL_INITIALIZER NULL
277 
278 #define IOT_TASKPOOL_JOB_STORAGE_INITIALIZER { { NULL, NULL }, NULL, NULL, 0, IOT_TASKPOOL_STATUS_UNDEFINED }
279 
280 #define IOT_TASKPOOL_JOB_INITIALIZER NULL
281 /* @[define_taskpool_initializers] */
290 #define IOT_TASKPOOL_JOB_HIGH_PRIORITY ( ( uint32_t ) 0x00000001 )
291 
298 #define IOT_SYSTEM_TASKPOOL ( IotTaskPool_GetSystemTaskPool() )
299 
300 #endif /* ifndef IOT_TASKPOOL_TYPES_H_ */
Task pool operation failed because it is illegal.
Definition: iot_taskpool_types.h:65
Job has been queued for execution.
Definition: iot_taskpool_types.h:110
Task pool operation failed because allocating memory failed.
Definition: iot_taskpool_types.h:70
Task pool cancellation failed.
Definition: iot_taskpool_types.h:80
Task pool operation failed because of an invalid parameter.
Definition: iot_taskpool_types.h:75
Job has been scheduled for deferred execution.
Definition: iot_taskpool_types.h:116
struct _taskPoolJob * IotTaskPoolJob_t
Opaque handle of a Task Pool Job.
Definition: iot_taskpool_types.h:190
Job status is undefined.
Definition: iot_taskpool_types.h:134
IotTaskPoolJobStatus_t
Status codes of task pool Job.
Definition: iot_taskpool_types.h:98
Job is ready to be scheduled.
Definition: iot_taskpool_types.h:104
Task pool operation general failure.
Definition: iot_taskpool_types.h:85
Job has been canceled before executing.
Definition: iot_taskpool_types.h:128
struct _taskPool * IotTaskPool_t
Opaque handle of a Task Pool instance.
Definition: iot_taskpool_types.h:156
Task pool operation completed successfully.
Definition: iot_taskpool_types.h:55
Task pool operation failed because at least one parameter is invalid.
Definition: iot_taskpool_types.h:60
IotTaskPoolError_t
Return codes of task pool functions.
Definition: iot_taskpool_types.h:50
The job storage data structure provides the storage for a statically allocated Task Pool Job instance...
Definition: iot_taskpool_types.h:166
Initialization information to create one task pool instance.
Definition: iot_taskpool_types.h:218
Job is executing.
Definition: iot_taskpool_types.h:122
void(* IotTaskPoolRoutine_t)(IotTaskPool_t pTaskPool, IotTaskPoolJob_t pJob, void *pUserContext)
Callback type for a user callback.
Definition: iot_taskpool_types.h:203