12#error This is a C++ include file and cannot be used from plain C
26#include <sys/socket.h>
73 explicit ngcbSEM(
unsigned int count);
76 ngcbSEM(
unsigned int count,
int check);
82 int Create(
ngcbSEM_T *sp,
unsigned int count,
int check,
char *erms = NULL);
130 int Set(
unsigned int cnt);
199 void *arg,
size_t stack = 0);
203 ngcbTHREAD_T *threadId,
size_t stack,
char *erms = NULL);
212 int ThrKill(
int sig,
char *erms = NULL);
218 int ThrJoin(
char *erms = NULL);
288 ngcbTIMER(
int after,
int periodic,
int ms,
int id);
ngcbPTIMER(int ms, int id)
Constructor with timer value and id.
Definition ngcbTHREAD.hpp:333
ngcbPTIMER(int after, int ms, int id)
Constructor with start delay (milliseconds), timer value and id.
Definition ngcbTHREAD.hpp:336
ngcbPTIMER(int ms)
Constructor with timer value (milliseconds)
Definition ngcbTHREAD.hpp:330
virtual ~ngcbPTIMER()
Destructor.
Definition ngcbTHREAD.hpp:339
ngcbSEMC(unsigned int count)
Constructor.
Definition ngcbTHREAD.hpp:161
virtual ~ngcbSEMC()
Destructor.
Definition ngcbTHREAD.hpp:164
int Lock()
Lock this semaphore.
Definition ngcbSEM.cpp:331
int Destroy(ngcbSEM_T *sp, char *erms=NULL)
Destroy a semaphore.
Definition ngcbSEM.cpp:133
int TryWait()
Try to wait for this semaphore.
Definition ngcbSEM.cpp:422
int Wait()
Wait for this semaphore.
Definition ngcbSEM.cpp:409
ngcbSEM()
Constructor.
Definition ngcbSEM.cpp:26
int TryLock()
Try to lock this semaphore.
Definition ngcbSEM.cpp:357
int Set(ngcbSEM_T *sp, unsigned int cnt)
Set semaphore counter.
Definition ngcbSEM.cpp:229
size_t Cnt()
Get actual value of this semaphore counter.
Definition ngcbSEM.cpp:435
virtual ~ngcbSEM()
Destructor.
Definition ngcbSEM.cpp:53
size_t WaitCnt(ngcbSEM_T *sp, size_t cnt)
Wait until counter is reached exactly or becomes zereo.
Definition ngcbSEM.cpp:247
int Unlock()
Unlock this semaphore.
Definition ngcbSEM.cpp:344
int Create(ngcbSEM_T *sp, unsigned int count, int check, char *erms=NULL)
Create a semaphore of given type (error checking on or off)
Definition ngcbSEM.cpp:71
int Post()
Post this semaphore.
Definition ngcbSEM.cpp:370
Definition ngcbTHREAD.hpp:185
int FdOut()
Return file descrioptor to wakeup a thread.
Definition ngcbTHREAD.cpp:313
ngcbTHREAD()
Normal constructor.
Definition ngcbTHREAD.cpp:52
void ThrExit()
Thread exit.
Definition ngcbTHREAD.cpp:212
virtual ~ngcbTHREAD()
Destructor.
Definition ngcbTHREAD.cpp:128
int ThrJoin(ngcbTHREAD_T threadId, char *erms=NULL)
Wait for a thread.
Definition ngcbTHREAD.cpp:259
ngcbTHREAD_T ThreadId()
Get own thread-Id.
Definition ngcbTHREAD.cpp:309
int ThrEqual(ngcbTHREAD_T t1, ngcbTHREAD_T t2)
Test the equality of the two threads t1 and t2.
Definition ngcbTHREAD.cpp:304
int ThrKill(ngcbTHREAD_T threadId, int sig, char *erms=NULL)
Cancel thread by thread-id.
Definition ngcbTHREAD.cpp:221
int FdIn()
Return file descriptor to be used by the thread for wakeup call.
Definition ngcbTHREAD.cpp:315
void * ExecProc()
Entry point for c-linkage thread.
Definition ngcbTHREAD.cpp:317
int Initialized()
Return flag for successful initialization.
Definition ngcbTHREAD.cpp:311
int ThrCreate(ngcbTHREAD *app, ngcbPROCESS_T process, void *arg, ngcbTHREAD_T *threadId, size_t stack, char *erms=NULL)
Thread creation.
Definition ngcbTHREAD.cpp:175
virtual ngcbTHREAD * NewThread(ngcbTHREAD *app, ngcbPROCESS_T process, void *arg, size_t stack=0)
Process to be overloaded.
Definition ngcbTHREAD.cpp:168
int Fd()
Return timer file descriptor for select call.
Definition ngcbTIMER.cpp:86
ngcbTIMER & operator=(const ngcbTIMER &other)
Operator =.
Definition ngcbTIMER.cpp:27
virtual ~ngcbTIMER()
Destructor.
Definition ngcbTIMER.cpp:81
ngcbTIMER(const ngcbTIMER &other)
Copy constructor.
Definition ngcbTIMER.cpp:40
int RecvId()
Receive timer id.
Definition ngcbTIMER.cpp:181
void(ngcbTHREAD::* ngcbPROCESS_T)(ngcbTHREAD *thread, void *arg)
Definition ngcbTHREAD.hpp:180
int ngcbInSignalHandler
Definition ngcbTHREAD.cpp:25
pthread_t ngcbTHREAD_T
Definition ngcbTHREAD.hpp:57
void * ngcbTHREAD_ExecProc(void *arg)
Definition ngcbTHREAD.cpp:30
Definition ngcbTHREAD.hpp:43
pthread_mutex_t mutex_v
Protection mutex.
Definition ngcbTHREAD.hpp:45
pthread_cond_t lck
Condition variable.
Definition ngcbTHREAD.hpp:48
size_t val
Semaphore counter value.
Definition ngcbTHREAD.hpp:51