summaryrefslogtreecommitdiffstats
path: root/raul
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-01-10 21:37:09 +0000
committerDavid Robillard <d@drobilla.net>2011-01-10 21:37:09 +0000
commit6be5a6abd94d9d33562f8911578d246af0c7ab4d (patch)
tree72ef57b3c7f02a3d89d782e16de596aa4b2df7bd /raul
parentfdd05425e3e74769f5224475fb53fd20863af2f7 (diff)
downloadraul-6be5a6abd94d9d33562f8911578d246af0c7ab4d.tar.gz
raul-6be5a6abd94d9d33562f8911578d246af0c7ab4d.tar.bz2
raul-6be5a6abd94d9d33562f8911578d246af0c7ab4d.zip
Remove Raul::Command (mostly useless thin wrapper around a semaphore).
Remove Semaphore::has_waiter (not portable). git-svn-id: http://svn.drobilla.net/lad/trunk/raul@2822 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'raul')
-rw-r--r--raul/Command.hpp55
-rw-r--r--raul/Semaphore.hpp13
2 files changed, 4 insertions, 64 deletions
diff --git a/raul/Command.hpp b/raul/Command.hpp
deleted file mode 100644
index 886acc8..0000000
--- a/raul/Command.hpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/* This file is part of Raul.
- * Copyright (C) 2007-2009 David Robillard <http://drobilla.net>
- *
- * Raul is free software; you can redistribute it and/or modify it under the
- * terms of the GNU General Public License as published by the Free Software
- * Foundation; either version 2 of the License, or (at your option) any later
- * version.
- *
- * Raul is distributed in the hope that it will be useful, but WITHOUT ANY
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
- * FOR A PARTICULAR PURPOSE. See the GNU General Public License for details.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
- * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#ifndef RAUL_COMMAND_HPP
-#define RAUL_COMMAND_HPP
-
-#include <boost/utility.hpp>
-#include "raul/Semaphore.hpp"
-
-namespace Raul {
-
-
-/** A blocking command to be executed in the audio thread.
- *
- * This is useful for calling simple parameterless commands from another thread
- * (OSC, GUI, etc) and waiting on the result. Works well for coarsely timed
- * events (e.g. 'play' clicked in a GUI).
- *
- * Realtime safe on the command executing side.
- *
- * \ingroup raul
- */
-class Command : boost::noncopyable {
-public:
- inline Command() : _sem(0) {}
-
- /** Caller context */
- inline void operator()() { _sem.wait(); }
-
- /** Execution context */
- inline bool pending() { return _sem.has_waiter(); }
- inline void finish() { _sem.post(); }
-
-private:
- Semaphore _sem;
-};
-
-
-} // namespace Raul
-
-#endif // RAUL_COMMAND_HPP
diff --git a/raul/Semaphore.hpp b/raul/Semaphore.hpp
index c7b29ef..e17b788 100644
--- a/raul/Semaphore.hpp
+++ b/raul/Semaphore.hpp
@@ -52,6 +52,10 @@ public:
#endif
}
+ /** Destroy and reset the semaphore to an initial value.
+ *
+ * This must not be called while there are any waiters.
+ */
inline void reset(unsigned int initial) {
#ifdef __APPLE__
MPDeleteSemaphore(_sem);
@@ -62,15 +66,6 @@ public:
#endif
}
- inline bool has_waiter() {
- int val;
- #ifdef __APPLE__
- #else
- sem_getvalue(&_sem, &val);
- #endif
- return (val <= 0);
- }
-
/** Increment (and signal any waiters).
*
* Realtime safe.