From bc07174c0e2201e7efc311401fbb89b0831024e4 Mon Sep 17 00:00:00 2001 From: kiritow <1362050620@qq.com> Date: Wed, 27 Dec 2017 12:01:13 +0800 Subject: [PATCH] Fix marco definition --- src/ProcessSemaphore_Linux.cpp | 3 ++- src/ProcessSemaphore_Posix.cpp | 5 +++-- src/ProcessSemaphore_Windows.cpp | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/ProcessSemaphore_Linux.cpp b/src/ProcessSemaphore_Linux.cpp index a52a21d..51e72da 100644 --- a/src/ProcessSemaphore_Linux.cpp +++ b/src/ProcessSemaphore_Linux.cpp @@ -1,4 +1,5 @@ -#ifdef __linux__ /// Linux +#if (defined(__linux__)&&!defined(_TRY_POSIX)) /// Linux platform without trying posix. + #include "SemaphoreWrapper.h" #include diff --git a/src/ProcessSemaphore_Posix.cpp b/src/ProcessSemaphore_Posix.cpp index 8ec3278..c2cba76 100644 --- a/src/ProcessSemaphore_Posix.cpp +++ b/src/ProcessSemaphore_Posix.cpp @@ -1,4 +1,4 @@ -#if (!defined(_WIN32)&&!defined(__linux__)) /// Not Windows or linux... Try posix. +#ifdef _TRY_POSIX /// Try posix. #include "SemaphoreWrapper.h" #include @@ -42,6 +42,7 @@ ProcessSemaphore::ProcessSemaphore(int key, int action, int default_value) : _p( } else { + /// Notice: Most platform reports "Function not implemented" on sem_open. dprintf("Failed to sem_open. %s\n",strerror(errno)); } } @@ -86,4 +87,4 @@ int ProcessSemaphore::notify() return v(); } -#endif +#endif /// End of Try Posix diff --git a/src/ProcessSemaphore_Windows.cpp b/src/ProcessSemaphore_Windows.cpp index b8637df..ecbd136 100644 --- a/src/ProcessSemaphore_Windows.cpp +++ b/src/ProcessSemaphore_Windows.cpp @@ -1,4 +1,4 @@ -#ifdef _WIN32 +#if (defined(_WIN32)&&!defined(_TRY_POSIX)) /// Windows platform without trying posix. #include "SemaphoreWrapper.h" #include