18 #ifndef __etq_h_included 19 #define __etq_h_included 37 DECLARE_ERROR(EThreadQueueBaseError_MultipleReadersNotAllowed);
54 typedef union _etmessage_data {
62 UChar bytes[
sizeof(LongLong)];
87 m_data.u.lowPart = lowPart;
88 m_data.u.highPart = highPart;
96 m_data.voidPtr = voidPtr;
104 m_data.quadPart = quadPart;
110 m_msgid = msg.m_msgid;
111 m_data.quadPart = msg.m_data.quadPart;
123 m_msgid = val.m_msgid;
124 m_timer = val.m_timer;
125 m_data.quadPart = val.m_data.quadPart;
141 Void
set(UInt msgid, Dword lowPart, Long highPart)
144 m_data.u.lowPart = lowPart;
145 m_data.u.highPart = highPart;
150 Void
set(UInt msgid, pVoid voidPtr)
153 m_data.voidPtr = voidPtr;
158 Void
set(UInt msgid, LongLong quadPart)
161 m_data.quadPart = quadPart;
180 return m_data.u.lowPart;
186 return m_data.u.highPart;
192 return m_data.quadPart;
198 return m_data.voidPtr;
204 etmessage_data_t m_data;
212 class EThreadMessageQueuePublic;
213 class EThreadMessageQueuePrivate;
218 friend class EThreadMessageQueuePublic;
219 friend class EThreadMessageQueuePrivate;
220 friend class EThreadBase;
230 Bool push(UInt msgid, Bool wait =
True);
231 Bool push(UInt msgid, Dword lowPart, Long highPart, Bool wait =
True);
232 Bool push(UInt msgid, pVoid voidPtr, Bool wait =
True);
233 Bool push(UInt msgid, LongLong quadPart, Bool wait =
True);
238 Bool isInitialized() {
return m_initialized; }
239 Mode mode() {
return m_mode; }
242 Bool push(UInt msgid, EThreadMessage::etmessage_data_t &d, Bool wait =
True);
244 virtual Bool isPublic() = 0;
245 virtual Int &msgCnt() = 0;
246 virtual Int &msgHead() = 0;
247 virtual Int &msgTail() = 0;
248 virtual Bool &multipleWriters() = 0;
249 virtual Int &numReaders() = 0;
250 virtual Int &numWriters() = 0;
251 virtual Int &refCnt() = 0;
253 virtual Void allocDataSpace(cpStr sFile, Char cId, Int nSize) = 0;
254 virtual Void initMutex() = 0;
255 virtual Void initSemFree(UInt initialCount) = 0;
256 virtual Void initSemMsgs(UInt initialCount) = 0;
265 Void init(Int nMsgCnt, Int threadId, Bool bMultipleWriters,
266 EThreadQueueBase::Mode eMode);
284 Void init(Int nMsgCnt, Int threadId, Bool bMultipleWriters,
285 EThreadQueueBase::Mode eMode)
287 EThreadQueueBase::init(nMsgCnt, threadId, bMultipleWriters, eMode);
291 Bool isPublic() {
return True; }
292 Int &msgCnt() {
return m_pCtrl->m_msgCnt; }
293 Int &msgHead() {
return m_pCtrl->m_head; }
294 Int &msgTail() {
return m_pCtrl->m_tail; }
295 Bool &multipleWriters() {
return m_pCtrl->m_multipleWriters; }
296 Int &numReaders() {
return m_pCtrl->m_numReaders; }
297 Int &numWriters() {
return m_pCtrl->m_numWriters; }
298 Int &refCnt() {
return m_pCtrl->m_refCnt; }
300 Void allocDataSpace(cpStr sFile, Char cId, Int nSize);
302 Void initSemFree(UInt initialCount);
303 Void initSemMsgs(UInt initialCount);
305 EMutexData &mutex() {
return ESynchObjects::getMutex(m_pCtrl->m_mutexid); }
306 ESemaphoreData &semFree() {
return ESynchObjects::getSemaphore(m_pCtrl->m_freeSemId); }
307 ESemaphoreData &semMsgs() {
return ESynchObjects::getSemaphore(m_pCtrl->m_msgsSemId); }
315 Bool m_multipleWriters;
324 } ethreadmessagequeue_ctrl_t;
327 ethreadmessagequeue_ctrl_t *m_pCtrl;
340 Void init(Int nMsgCnt, Int threadId, Bool bMultipleWriters,
341 EThreadQueueBase::Mode eMode)
343 EThreadQueueBase::init(nMsgCnt, threadId, bMultipleWriters, eMode);
347 Bool isPublic() {
return False; }
348 Int &msgCnt() {
return m_msgCnt; }
349 Int &msgHead() {
return m_head; }
350 Int &msgTail() {
return m_tail; }
351 Bool &multipleWriters() {
return m_multipleWriters; }
352 Int &numReaders() {
return m_numReaders; }
353 Int &numWriters() {
return m_numWriters; }
354 Int &refCnt() {
return m_refCnt; }
356 Void allocDataSpace(cpStr sFile, Char cId, Int nSize);
358 Void initSemFree(UInt initialCount);
359 Void initSemMsgs(UInt initialCount);
369 Bool m_multipleWriters;
387 #endif // #define __etq_h_included Definition of a public event thread message queue.
Definition: etevent.h:566
#define True
True.
Definition: ebase.h:25
Macros for various standard C library functions and standard includes.
EThreadMessage(UInt msgid)
Class constructor.
Definition: etq.h:75
ETimer & getTimer()
Retrieves the ETimer object associated with this event.
Definition: etq.h:166
Defines a class for access to shared memory.
The shared memory access class.
Definition: eshmem.h:43
Dword & getLowPart()
Retrieves the unsigned 32-bit value associated with this message.
Definition: etq.h:178
EThreadMessage(UInt msgid, Dword lowPart, Long highPart)
Class constructor.
Definition: etq.h:84
Definition of a private event thread message queue.
Definition: etevent.h:681
Allows read or write access.
EThreadMessage()
Default constructor.
Definition: etq.h:68
Implements a stopwatch style timer.
Definition: etimer.h:26
Contains the data associated with a public or private mutex.
Definition: esynch.h:72
Contains the data associated with a public or private semaphore.
Definition: esynch.h:268
~EThreadMessage()
Class destructor.
Definition: etq.h:114
EThreadMessage & operator=(const EThreadMessage &val)
Assignment operator.
Definition: etq.h:121
#define False
False.
Definition: ebase.h:27
Defines base class for exceptions and declaration helper macros.
LongLong & getQuadPart()
Retrieves the signed 64-bit value associated with this message.
Definition: etq.h:190
EThreadMessage(UInt msgid, LongLong quadPart)
Class constructor.
Definition: etq.h:101
An event message that is to be sent to a thread.
Definition: etevent.h:264
Defines the functionality for the thread queue.
Definition: etevent.h:359
pVoid & getVoidPtr()
Retrieves the void pointer value associated with this message.
Definition: etq.h:196
UInt & getMsgId()
Retrieves the message ID associated with this message.
Definition: etq.h:172
#define DECLARE_ERROR(__e__)
Declares exception class derived from EError with no constructor parameters.
Definition: eerror.h:53
friend class EThreadQueueBase
Definition: etq.h:50
Long & getHighPart()
Retrieves the signed 32-bit value associated with this message.
Definition: etq.h:184
Represents a private semaphore, the semaphore data is allocated from either the stack or heap...
Definition: esynch.h:382
EThreadMessage(UInt msgid, pVoid voidPtr)
Class constructor.
Definition: etq.h:93
A private mutex (the mutex data is allocated from either the heap or stack).
Definition: esynch.h:175
EThreadMessage(const EThreadMessage &msg)
Copy constructor.
Definition: etq.h:108
T & data()
Retrieves the data portion of the message.
Definition: etevent.h:231
Contains definitions for synchronization objects.