Add timeout to Semaphore::wait

This commit is contained in:
Vinnie Falco
2013-07-29 13:19:53 -07:00
parent 1fdaa6781b
commit cfa5a3b9ca
2 changed files with 33 additions and 21 deletions

View File

@@ -49,8 +49,12 @@ public:
void signal (int amount = 1);
/** Wait for a resource.
A negative time-out value means that the method will wait indefinitely.
@returns true if the event has been signalled, false if the timeout expires.
*/
void wait ();
bool wait (int timeOutMilliseconds = -1);
private:
class WaitingThread
@@ -60,7 +64,7 @@ private:
public:
WaitingThread ();
void wait ();
bool wait (int timeOutMilliseconds);
void signal ();
private: