#include "pthread.h" 


#ifndef _SEMAPHORE



//typedef hot_sema_t semaphore;

//int createSemaphore (int initValue, semaphore *s);

//int decSemaphore (semaphore s);

//int incSemaphore (semaphore s);


typedef struct semaphore
{
    int         v;
    pthread_mutex_t mutex;
    pthread_cond_t cond;
} semaphore;


int         decSemaphore (semaphore * s);
int         decSemaphoreNotBlock (semaphore * s);
int         incSemaphore (semaphore * s);
int         destroySemaphore (semaphore * s);
int         createSemaphore (int initValue, semaphore * s);
int         ValueSemaphore (semaphore * s);
int         tw_pthread_cond_signal (pthread_cond_t * c);
int         tw_pthread_cond_wait (pthread_cond_t * c, pthread_mutex_t * m);
int         tw_pthread_mutex_unlock (pthread_mutex_t * m);
int         tw_pthread_mutex_lock (pthread_mutex_t * m);
void        do_error (char *msg);

#define _SEMAPHORE
#endif
