19 #ifndef _CL_EO_QUEUE_H_
20 #define _CL_EO_QUEUE_H_
28 #include <clJobList.h>
29 #include <clTaskPool.h>
35 #define CL_EO_QUEUE_LOCK(lock) do { \
36 ClRcT retCode = clOsalMutexLock(lock); \
37 CL_ASSERT(retCode == CL_OK); \
40 #define CL_EO_QUEUE_UNLOCK(lock) do { \
41 ClRcT retCode = clOsalMutexUnlock(lock); \
42 CL_ASSERT(retCode == CL_OK); \
46 #define CL_EO_RECV_QUEUE_PRI(_rec_param) \
47 ( ( (_rec_param).protoType == CL_IOC_RMD_ORDERED_PROTO ) ? CL_IOC_ORDERED_PRIORITY : \
48 ( ( (_rec_param).protoType == CL_IOC_PORT_NOTIFICATION_PROTO ) ? CL_IOC_NOTIFICATION_PRIORITY : \
49 ( ( (_rec_param).priority >= CL_IOC_MAX_PRIORITIES ) ? CL_IOC_DEFAULT_PRIORITY : (_rec_param).priority ) ) )
51 #define CL_EO_RECV_QUEUE_PRI(_rec_param) \
52 ( ( (_rec_param).protoType == CL_IOC_RMD_ORDERED_PROTO ) ? CL_IOC_ORDERED_PRIORITY : \
53 ( ( (_rec_param).protoType == CL_IOC_PORT_NOTIFICATION_PROTO ) ? CL_IOC_HIGH_PRIORITY : \
54 ( ( (_rec_param).priority == CL_IOC_HIGH_PRIORITY ) ? CL_IOC_HIGH_PRIORITY : CL_IOC_DEFAULT_PRIORITY ) ) )
58 #define CL_EO_RC(rc) CL_RC(CL_CID_EO,rc)
61 #define CL_EO_SCHED_POLICY (CL_OSAL_SCHED_OTHER)
63 typedef enum ClEoQueueState
65 CL_EO_QUEUE_STATE_ACTIVE = 0x1,
67 CL_EO_QUEUE_STATE_QUIESCED = 0x2,
70 typedef enum ClThreadPoolMode
72 CL_THREAD_POOL_MODE_NORMAL=1,
73 CL_THREAD_POOL_MODE_EXCLUSIVE,
74 CL_THREAD_POOL_MODE_MAX,
77 #define CL_EO_ALIGN(v,a) ( ((v) + (a)-1) & ~((a)-1) )
79 #define CL_EO_QUEUE_LEN(queue) ((queue)->numElements - (queue)->numThreadsWaiting)
81 #define CL_EO_QUEUE_POP(eoQueue,cast,data) do { \
83 if(!CL_JOB_LIST_EMPTY(&(eoQueue)->queue)) \
85 data = (cast*)clJobPop(&(eoQueue)->queue); \
86 CL_ASSERT(data != NULL); \
87 --(eoQueue)->numElements; \
88 CL_ASSERT((eoQueue)->numElements>=0); \
92 #define CL_EO_QUEUE_ADD_HEAD(eoQueue,element) do { \
93 ClRcT retCode = CL_OK; \
94 retCode = clJobAdd((element),&(eoQueue)->queue); \
95 CL_ASSERT(retCode == CL_OK); \
96 ++(eoQueue)->numElements; \
99 #define CL_EO_QUEUE_ADD(eoQueue,element) do { \
100 ClRcT retCode = CL_OK; \
101 retCode = clJobAddTail((element),&(eoQueue)->queue); \
102 CL_ASSERT(retCode == CL_OK); \
103 ++(eoQueue)->numElements; \
106 #define CL_EO_DELAY(delay) do { \
107 ClTimerTimeOutT timeout = {0}; \
108 if((delay)==0) (delay) = 1000; \
109 timeout.tsSec =(delay)/1000; \
110 timeout.tsMilliSec=(delay)%1000; \
111 clOsalTaskDelay(timeout); \
114 typedef struct ClEoJob
120 typedef ClRcT (*ClEoJobCallBackT)(ClEoJobT *pJob, ClPtrT pUserData);
124 typedef struct ClEoQueue
128 struct ClThreadPool *pThreadPool;
129 ClInt32T numElements;
130 ClInt32T numThreadsWaiting;
132 ClEoQueueStateT state;
137 typedef ClPtrT ClEoQueueHandleT;
140 ClRcT clEoQueueInitialize(
void);
142 ClRcT clEoQueueCreate(ClEoQueueHandleT *pHandle,
144 ClThreadPoolModeT mode,
146 ClInt32T threadPriority,
147 ClEoJobCallBackT pJobHandler,
152 ClBoolT stopThreadPool);
154 void clEoQueuesQuiesce(
void);
156 void clEoQueuesUnquiesce(
void);
164 ClRcT clEoQueueFinalize(
void);
166 ClRcT clEoQueueFinalizeSync(ClBoolT force);
Typical defines found in any software project.
Common Error Codes shared across multiple Clovis ASP Components.
Header file of Buffer Management related APIs.
Header file of Debug Service Related APIs.
Header file of Ioc Data Structures and APIs.
Operating System Abstraction Layer API.
ClPtrT ClBufferHandleT
The type of the handle for the buffer messages.
Definition: clBufferApi.h:82
ClUint32T ClRcT
Clovis return code type.
Definition: clCommon.h:168
ClIocPriorityT
This defines all the priorities that can be used with IOC.
Definition: clIocApi.h:224
pthread_cond_t ClOsalCondT
The thread condition type wrapped.
Definition: clOsalApi.h:204
The IOC receive returns this structure along with the message.
Definition: clIocApi.h:491