summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/PollableCondition.h
diff options
context:
space:
mode:
authorStephen D. Huston <shuston@apache.org>2009-02-20 00:04:37 +0000
committerStephen D. Huston <shuston@apache.org>2009-02-20 00:04:37 +0000
commitd4b433f542ab8a506d7dbc53e685770a96ee7958 (patch)
treef0b7d7c643825f279c45f74a8c17f7b0753b53de /cpp/src/qpid/sys/PollableCondition.h
parent44ff0feac9edbf7faffdeed5a3df22313e0543c8 (diff)
downloadqpid-python-d4b433f542ab8a506d7dbc53e685770a96ee7958.tar.gz
Merged win-pollable-condition branch changes 743545:746056 into trunk
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@746061 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys/PollableCondition.h')
-rw-r--r--cpp/src/qpid/sys/PollableCondition.h54
1 files changed, 52 insertions, 2 deletions
diff --git a/cpp/src/qpid/sys/PollableCondition.h b/cpp/src/qpid/sys/PollableCondition.h
index 56d38f90da..49e84e6cb0 100644
--- a/cpp/src/qpid/sys/PollableCondition.h
+++ b/cpp/src/qpid/sys/PollableCondition.h
@@ -22,7 +22,57 @@
*
*/
-// Currently only has a posix implementation, add #ifdefs for other platforms as needed.
-#include "posix/PollableCondition.h"
+#include "qpid/sys/Poller.h"
+#include <boost/function.hpp>
+#include <boost/shared_ptr.hpp>
+
+
+namespace qpid {
+namespace sys {
+
+class PollableConditionPrivate;
+
+class PollableCondition {
+public:
+ typedef boost::function1<void, PollableCondition&> Callback;
+
+ PollableCondition(const Callback& cb,
+ const boost::shared_ptr<sys::Poller>& poller);
+
+ ~PollableCondition();
+
+ /**
+ * Set the condition. Triggers callback to Callback from Poller.
+ * When callback is made, condition is suspended. Call rearm() to
+ * resume reacting to the condition.
+ */
+ void set();
+
+ /**
+ * Get the current state of the condition, then clear it.
+ *
+ * @return The state of the condition before it was cleared.
+ */
+ bool clear();
+
+ /**
+ * Temporarily suspend the ability for the poller to react to the
+ * condition. It can be rearm()ed later.
+ */
+ void disarm();
+
+ /**
+ * Reset the ability for the poller to react to the condition.
+ */
+ void rearm();
+
+ private:
+ PollableConditionPrivate *impl;
+
+ Callback callback;
+ boost::shared_ptr<sys::Poller> poller;
+};
+
+}} // namespace qpid::sys
#endif /*!QPID_SYS_POLLABLECONDITION_H*/