From 029e9c14796e663f7171e47bfb9e712d0b23f289 Mon Sep 17 00:00:00 2001 From: Carlos Daniel Ruvalcaba Valenzuela Date: Thu, 26 Jul 2007 06:03:13 -0700 Subject: [PATCH] Updated semaphore code --- include/libfmail/semaphore.h | 1 + src/posix-sem.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/include/libfmail/semaphore.h b/include/libfmail/semaphore.h index d6d8340..f3d86c5 100644 --- a/include/libfmail/semaphore.h +++ b/include/libfmail/semaphore.h @@ -30,5 +30,6 @@ public: int TryWait(); int Wait(); int Post(); + int getValue(); }; diff --git a/src/posix-sem.cpp b/src/posix-sem.cpp index 482eea6..c9f2842 100644 --- a/src/posix-sem.cpp +++ b/src/posix-sem.cpp @@ -50,3 +50,9 @@ int Semaphore::Post(){ sem_post(&(os_sem->sem)); } +int Semaphore::getValue(){ + int ret; + sem_getvalue(&(os_sem->sem), &ret); + + return ret; +} -- 2.11.4.GIT