summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/sys
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2008-08-06 21:17:19 +0000
committerAlan Conway <aconway@apache.org>2008-08-06 21:17:19 +0000
commit03c3f6edb2b17841053250bda46fde1054d32d67 (patch)
tree09f7c1d5ddbde595164414f1c0ba1d860675a315 /cpp/src/qpid/sys
parent31b2f1436808fc07f636dc02416386e44b23071c (diff)
downloadqpid-python-03c3f6edb2b17841053250bda46fde1054d32d67.tar.gz
- Added OutputTask::hasOutput() test.
- Cluster only sends doOutput events when hasOutput() git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@683416 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/sys')
-rw-r--r--cpp/src/qpid/sys/AggregateOutput.cpp6
-rw-r--r--cpp/src/qpid/sys/AggregateOutput.h1
-rw-r--r--cpp/src/qpid/sys/OutputTask.h10
3 files changed, 17 insertions, 0 deletions
diff --git a/cpp/src/qpid/sys/AggregateOutput.cpp b/cpp/src/qpid/sys/AggregateOutput.cpp
index 57cc0c5a33..2fad28c381 100644
--- a/cpp/src/qpid/sys/AggregateOutput.cpp
+++ b/cpp/src/qpid/sys/AggregateOutput.cpp
@@ -31,6 +31,12 @@ void AggregateOutput::activateOutput()
control.activateOutput();
}
+bool AggregateOutput::hasOutput() {
+ for (TaskList::const_iterator i = tasks.begin(); i != tasks.end(); ++i)
+ if ((*i)->hasOutput()) return true;
+ return false;
+}
+
bool AggregateOutput::doOutput()
{
bool result = false;
diff --git a/cpp/src/qpid/sys/AggregateOutput.h b/cpp/src/qpid/sys/AggregateOutput.h
index a870fcb95a..02a53ed50b 100644
--- a/cpp/src/qpid/sys/AggregateOutput.h
+++ b/cpp/src/qpid/sys/AggregateOutput.h
@@ -43,6 +43,7 @@ namespace sys {
void activateOutput();
//all the following will be called on the same thread
bool doOutput();
+ bool hasOutput();
void addOutputTask(OutputTask* t);
void removeOutputTask(OutputTask* t);
};
diff --git a/cpp/src/qpid/sys/OutputTask.h b/cpp/src/qpid/sys/OutputTask.h
index 109765b8c3..005ae7dbc4 100644
--- a/cpp/src/qpid/sys/OutputTask.h
+++ b/cpp/src/qpid/sys/OutputTask.h
@@ -28,7 +28,17 @@ namespace sys {
{
public:
virtual ~OutputTask() {}
+ /** Generate some output.
+ *@return true if output was generated, false if there is no work to do.
+ */
virtual bool doOutput() = 0;
+
+ /** Check if there may be work to do, but don't do it.
+ * @return True if there may be work to do, false if there is none.
+ * Can to return a false positive, to allow implementations to do a
+ * faster check than doOutput(). Must never return a false negative.
+ */
+ virtual bool hasOutput() = 0;
};
}