34 #include <semaphore.h>
59 void addSemaphore(
const char *name, sem_t *sem,
int value);
71 void waitSemaphore(
int id, sem_t *sem);
82 void signalSemaphore(
int id, sem_t *sem);
89 string getSemaphoreTable()
const;
101 vector<Semaphore> semArray;
105 Semaphore* findSemaphore(sem_t *sp) {
106 for (
unsigned int i = 0; i < semArray.size(); i++) {
107 if (semArray[i].sem == sp)
return &semArray[i];
111 Semaphore* findSemaphore(
string name) {
112 for (
unsigned int i = 0; i < semArray.size(); i++) {
113 if (semArray[i].name == name)
return &semArray[i];