From 25748fde9bdb02d8d1f857838d9e7111db4103a4 Mon Sep 17 00:00:00 2001 From: hyzboy Date: Thu, 23 Jan 2020 20:37:42 +0800 Subject: [PATCH] fix thread macro in Linux --- inc/hgl/platform/os/Linux.h | 2 +- inc/hgl/platform/os/PosixThread.h | 9 +++++---- inc/hgl/proc/ProcMutex.h | 2 +- inc/hgl/thread/CondVar.h | 2 +- inc/hgl/thread/Semaphore.h | 2 +- src/PlugIn/PlugInManage.cpp | 11 +++-------- 6 files changed, 12 insertions(+), 16 deletions(-) diff --git a/inc/hgl/platform/os/Linux.h b/inc/hgl/platform/os/Linux.h index 8e6e820..869c883 100644 --- a/inc/hgl/platform/os/Linux.h +++ b/inc/hgl/platform/os/Linux.h @@ -7,7 +7,7 @@ using u32char =char32_t; using u16char =char16_t; using os_char =char; #define to_oschar to_u8 -#define OS_TEXT(str) u8##str +#define OS_TEXT(str) str #define U8_TEXT(str) u8##str #define U16_TEXT(str) u##str diff --git a/inc/hgl/platform/os/PosixThread.h b/inc/hgl/platform/os/PosixThread.h index d9ee4ad..a17d8d8 100644 --- a/inc/hgl/platform/os/PosixThread.h +++ b/inc/hgl/platform/os/PosixThread.h @@ -2,6 +2,7 @@ #define HGL_POSIX_THREAD_INCLUDE #include +#include #ifdef __APPLE__ #include @@ -12,19 +13,19 @@ namespace hgl using thread_mutex_ptr =pthread_mutex_t; using thread_ptr =pthread_t; - using rwlock_ptr =pthread_rwlock_t *; + using rwlock_ptr =pthread_rwlock_t; #ifdef __APPLE__ using semaphore_ptr =dispatch_semaphore_t *; #else - using semaphore_ptr =sem_t *; + using semaphore_ptr =sem_t; #endif// - using cond_var_ptr =pthread_cond_t *; + using cond_var_ptr =pthread_cond_t; #define THREAD_FUNC void * #define HGL_THREAD_DETACH_SELF pthread_detach(pthread_self()); - using proc_mutex_ptr =sem_t *; + using proc_mutex_ptr =sem_t; }//namespace hgl #endif//HGL_POSIX_THREAD_INCLUDE diff --git a/inc/hgl/proc/ProcMutex.h b/inc/hgl/proc/ProcMutex.h index 5818ae9..262ea15 100644 --- a/inc/hgl/proc/ProcMutex.h +++ b/inc/hgl/proc/ProcMutex.h @@ -10,7 +10,7 @@ namespace hgl */ class ProcMutex ///进程排斥 { - proc_mutex_ptr lock; + proc_mutex_ptr *lock; public: diff --git a/inc/hgl/thread/CondVar.h b/inc/hgl/thread/CondVar.h index e69762e..1bb6382 100644 --- a/inc/hgl/thread/CondVar.h +++ b/inc/hgl/thread/CondVar.h @@ -12,7 +12,7 @@ namespace hgl */ class CondVar { - conv_var_ptr *cond_var; + cond_var_ptr *cond_var; public: diff --git a/inc/hgl/thread/Semaphore.h b/inc/hgl/thread/Semaphore.h index 2408b4a..650ff47 100644 --- a/inc/hgl/thread/Semaphore.h +++ b/inc/hgl/thread/Semaphore.h @@ -11,7 +11,7 @@ namespace hgl */ class Semaphore ///信号 { - semaphore_ptr ptr; + semaphore_ptr *ptr; public: diff --git a/src/PlugIn/PlugInManage.cpp b/src/PlugIn/PlugInManage.cpp index ed365e5..f695540 100644 --- a/src/PlugIn/PlugInManage.cpp +++ b/src/PlugIn/PlugInManage.cpp @@ -51,7 +51,7 @@ namespace hgl if(pi)return pi; - if(!FileExist(filename))return(false); + if(!FileExist(filename))return(nullptr); ExternalPlugIn *epi=new ExternalPlugIn; @@ -76,12 +76,7 @@ namespace hgl if(fp_count<=0)return(nullptr); -#if HGL_OS == HGL_OS_Windows - OSString pi_filename=name+L'.'+pi_name+HGL_PLUGIN_EXTNAME; -#else - OSString pi_filename=ToOSString(name)+'.'+ToOString(pi_name)+HGL_PLUGIN_EXTNAME; -#endif//HGL_OS == HGL_OS_Windows - + OSString pi_filename=name+OS_TEXT('.')+pi_name+HGL_PLUGIN_EXTNAME; OSString pi_fullfilename; ExternalPlugIn *epi=new ExternalPlugIn; @@ -106,7 +101,7 @@ namespace hgl bool PlugInManage::UnloadPlugin(const OSString &pi_name) { - if(pi_name.IsEmpty())return(nullptr); + if(pi_name.IsEmpty())return(false); this->Release(pi_name); return(true);