41 lines
620 B
C
41 lines
620 B
C
|
|
#ifndef CGE_THREAD_INTERNAL_H
|
||
|
|
#define CGE_THREAD_INTERNAL_H
|
||
|
|
|
||
|
|
#define _POSIX_C_SOURCE 200112L
|
||
|
|
#include "../CgeThread.h"
|
||
|
|
#include <unistd.h>
|
||
|
|
#include <pthread.h>
|
||
|
|
|
||
|
|
struct CgeCondition {
|
||
|
|
pthread_cond_t handle;
|
||
|
|
};
|
||
|
|
|
||
|
|
struct CgeMutex {
|
||
|
|
pthread_mutex_t handle;
|
||
|
|
};
|
||
|
|
|
||
|
|
#if (_POSIX_SEMAPHORES >= 200112L)
|
||
|
|
#include <semaphore.h>
|
||
|
|
|
||
|
|
struct CgeSemaphore {
|
||
|
|
sem_t handle;
|
||
|
|
};
|
||
|
|
#else
|
||
|
|
struct CgeSemaphore {
|
||
|
|
int count;
|
||
|
|
int waiters;
|
||
|
|
pthread_mutex_t mutex;
|
||
|
|
pthread_cond_t condition;
|
||
|
|
};
|
||
|
|
#endif
|
||
|
|
|
||
|
|
struct CgeThread {
|
||
|
|
pthread_t handle;
|
||
|
|
};
|
||
|
|
|
||
|
|
struct CgeTss {
|
||
|
|
pthread_key_t handle;
|
||
|
|
};
|
||
|
|
|
||
|
|
#endif /* CGE_THREAD_INTERNAL_H */
|