cross-platform define update

This commit is contained in:
2019-12-10 14:38:29 +08:00
parent 2d8da351ba
commit 1bfb503e13
6 changed files with 25 additions and 14 deletions

View File

@@ -3,13 +3,26 @@
#include<pthread.h>
#ifdef __APPLE__
#include<dispatch/dispatch.h>
#endif//__APPLE__
namespace hgl
{
using hgl_thread_mutex =pthread_mutex_t;
using thread_ptr =pthread_t;
using THREAD_FUNC =void *;
using rwlock_ptr =pthread_rwlock_t *;
#ifdef __APPLE__
using semaphore_ptr =dispatch_semaphore_t *;
#else
using semaphore_ptr =sem_t *;
#endif//
using cond_var_ptr =pthread_cond_t *;
#define THREAD_FUNC void *
#define HGL_THREAD_DETACH_SELF pthread_detach(pthread_self());
}//namespace hgl
#endif//HGL_POSIX_THREAD_INCLUDE