cross-platform define update
This commit is contained in:
@@ -50,7 +50,7 @@ inline T *hgl_aligned_malloc(size_t n)
|
||||
}
|
||||
|
||||
#define OS_EXTERNAL_H <dlfcn.h>
|
||||
typedef void * ExternalModulePointer;
|
||||
using ExternalModulePointer =void *;
|
||||
#define pi_get dlsym
|
||||
#define pi_close dlclose
|
||||
|
||||
|
@@ -59,7 +59,7 @@ using os_char =wchar_t;
|
||||
#endif//
|
||||
|
||||
#define OS_EXTERNAL_H <winbase.h>
|
||||
typedef HMODULE ExternalModulePointer;
|
||||
using ExternalModulePointer =HMODULE;
|
||||
#define pi_get GetProcAddress
|
||||
#define pi_close FreeLibrary
|
||||
|
||||
@@ -74,6 +74,10 @@ typedef HMODULE ExternalModulePointer;
|
||||
|
||||
using hgl_thread_mutex =CRITICAL_SECTION;
|
||||
using thread_ptr =HANDLE;
|
||||
using rwlock_ptr =SRWLOCK;
|
||||
using semaphore_ptr =HANDLE;
|
||||
using conv_var_ptr =CONDITION_VARIABLE;
|
||||
|
||||
#define THREAD_FUNC DWORD WINAPI
|
||||
#define HGL_THREAD_DETACH_SELF
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
@@ -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
|
||||
|
Reference in New Issue
Block a user