summaryrefslogtreecommitdiffstats
path: root/raul/Semaphore.h
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2007-03-31 05:28:01 +0000
committerDavid Robillard <d@drobilla.net>2007-03-31 05:28:01 +0000
commit69559bddc0ae41f1f81241d92675009f86fa79b1 (patch)
tree72a23a8c00e751432b918fb911b7355d84d219f3 /raul/Semaphore.h
parent423cbc959a04b6d54365b943b22936ec6b2a4b62 (diff)
downloadraul-69559bddc0ae41f1f81241d92675009f86fa79b1.tar.gz
raul-69559bddc0ae41f1f81241d92675009f86fa79b1.tar.bz2
raul-69559bddc0ae41f1f81241d92675009f86fa79b1.zip
Realtime MIDI recording.
git-svn-id: http://svn.drobilla.net/lad/raul@383 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul/Semaphore.h')
-rw-r--r--raul/Semaphore.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/raul/Semaphore.h b/raul/Semaphore.h
index 649d148..28bd93e 100644
--- a/raul/Semaphore.h
+++ b/raul/Semaphore.h
@@ -41,6 +41,9 @@ public:
inline ~Semaphore() { sem_destroy(&_sem); }
+ inline void reset(unsigned int initial)
+ { sem_destroy(&_sem); sem_init(&_sem, 0, initial); }
+
/** Increment (and signal any waiters).
*
* Realtime safe.
@@ -61,6 +64,7 @@ public:
* Realtime safe?
*/
inline int try_wait() { return sem_trywait(&_sem); }
+
private:
sem_t _sem;
};