summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys/PollableCondition.h
diff options
context:
space:
mode:
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*/