summaryrefslogtreecommitdiff
path: root/cpp/src/tests
diff options
context:
space:
mode:
authorAlan Conway <aconway@apache.org>2007-11-07 23:18:04 +0000
committerAlan Conway <aconway@apache.org>2007-11-07 23:18:04 +0000
commitf1ba4be4acb7387cbb52e71093d2a149a903b52f (patch)
tree071d5031fa4bb6bac70de2ca434ebad8c632bb34 /cpp/src/tests
parentb930ecd07bc7af075bef2f3fa958bfc118ad5f84 (diff)
downloadqpid-python-f1ba4be4acb7387cbb52e71093d2a149a903b52f.tar.gz
Fix race condition in perftest.
NOTE: in multi-process mode you must run the publisher first and wait for it to show "waiting for consumers" before starting consumers. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@592946 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/tests')
-rw-r--r--cpp/src/tests/perftest.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/cpp/src/tests/perftest.cpp b/cpp/src/tests/perftest.cpp
index d9316527bc..5d412d3837 100644
--- a/cpp/src/tests/perftest.cpp
+++ b/cpp/src/tests/perftest.cpp
@@ -71,15 +71,17 @@ struct PublishThread : public Runnable { Thread thread; void run(); };
// Create and purge the shared queues
void setup() {
- cout << "Create shared queues" << endl;
Connection connection;
opts.open(connection);
Session_0_10 session = connection.newSession();
session.setSynchronous(true); // Make sure this is all completed.
session.queueDeclare(arg::queue="control"); // Control queue
- session.queuePurge(arg::queue="control");
- if (mode==SHARED) {
+ if (!opts.publish)
+ return; // Only do this in publish thread.
+ if (mode==SHARED)
session.queueDeclare(arg::queue="perftest"); // Shared data queue
+ if (opts.publish) { // Only do this in the publisher process.
+ session.queuePurge(arg::queue="control");
session.queuePurge(arg::queue="perftest");
}
session.close();