Unverified Commit 10db5d0b authored by Rhett Ying's avatar Rhett Ying Committed by GitHub
Browse files

[BugFix] fix rpc-related build issue on mac OS (#4168)

* [BugFix] fix rpc-related build issue on mac OS

* add warning message

* add warning message
parent 9d425315
...@@ -50,6 +50,11 @@ void Semaphore::Wait() { ...@@ -50,6 +50,11 @@ void Semaphore::Wait() {
} }
bool Semaphore::TimedWait(int timeout) { bool Semaphore::TimedWait(int timeout) {
// sem_timedwait does not exist in Mac OS.
#ifdef __APPLE__
DLOG(WARNING) << "Timeout is not supported in semaphore's wait on Mac OS.";
Wait();
#else
// zero timeout means wait infinitely // zero timeout means wait infinitely
if (timeout == 0) { if (timeout == 0) {
DLOG(WARNING) << "Will wait infinitely on semaphore until posted."; DLOG(WARNING) << "Will wait infinitely on semaphore until posted.";
...@@ -82,6 +87,8 @@ bool Semaphore::TimedWait(int timeout) { ...@@ -82,6 +87,8 @@ bool Semaphore::TimedWait(int timeout) {
} }
return false; return false;
} }
#endif
return true; return true;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment