18 #ifndef __esynch2_h_included
19 #define __esynch2_h_included
58 _esynchcontrol_t m_semaphoreCtrl;
59 _esynchcontrol_t m_mutexCtrl;
68 Bool m_multipleReaders;
69 Bool m_multipleWriters;
75 virtual Int
getInitType() {
return STATIC_INIT_TYPE_PRIORITY; }
79 Void logObjectUsage();
81 static Int nextSemaphore();
82 static Int nextMutex();
84 static Void freeSemaphore(Int nSemId);
85 static Void freeMutex(Int nMutexId);
87 Long incSequence() {
return atomic_inc(m_pCtrl->m_sequence); }
89 epublicqueuedef_t *getPublicQueue(Int queueid)
91 for (
int i = 0; m_pPubQueues[i].m_name[0] != 0; i++)
93 if (m_pPubQueues[i].m_queueid == queueid)
94 return &m_pPubQueues[i];
100 Void setPublicQueue(Int idx, cpChar pName, Int queueid, Int msgSize,
101 Int msgCnt, Bool multipleReaders, Bool multipleWriters)
103 epc_strcpy_s(m_pPubQueues[idx].m_name,
sizeof(m_pPubQueues[idx].m_name), pName);
104 m_pPubQueues[idx].m_queueid = queueid;
105 m_pPubQueues[idx].m_msgSize = msgSize;
106 m_pPubQueues[idx].m_msgCnt = msgCnt;
107 m_pPubQueues[idx].m_multipleReaders = multipleReaders;
108 m_pPubQueues[idx].m_multipleWriters = multipleWriters;
114 throw ESynchObjectsError_PublicObjectsNotEnabled();
118 static ESemaphoreDataPublic &getSemaphore(Int ofs)
121 throw ESynchObjectsError_InvalidOffset();
122 return getSynchObjCtrlPtr()->m_pSemaphores[ofs - 1];
125 static EMutexDataPublic &getMutex(Int ofs)
128 throw ESynchObjectsError_InvalidOffset();
129 return getSynchObjCtrlPtr()->m_pMutexes[ofs - 1];
146 ESynchObjectsSharedMemory m_sharedmem;
147 esynchcontrol_t *m_pCtrl;
148 ESemaphoreDataPublic *m_pSemaphores;
149 EMutexDataPublic *m_pMutexes;
150 epublicqueuedef_t *m_pPubQueues;
155 #endif // #define __esynch2_h_included