From 6b5c686b366846b7ecb0bb298c41fe474e1fb3c8 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Thu, 5 Apr 2007 19:16:09 +0000 Subject: * Exteneded use of shared pointers frame bodies across all send() commands. * tests/Makefile.am: added check-unit target to run just unit tests. * Introduced make_shared_ptr convenience function for wrapping plain pointers with shared_ptr. * cpp/src/client/ClientChannel.h,cpp (sendsendAndReceive,sendAndReceiveSync): Pass shared_ptr instead of raw ptr to fix memory problems. Updated the following files to use make_shared_ptr - src/client/BasicMessageChannel.cpp - src/client/ClientConnection.cpp * src/client/MessageMessageChannel.cpp: implemented 0-9 message.get. * src/framing/Correlator.h,cpp: Allow request sender to register actions to take when the correlated response arrives. * cpp/src/tests/FramingTest.cpp: Added Correlator tests. * src/framing/ChannelAdapter.h,cpp: use Correlator to dispatch response actions. * cpp/src/shared_ptr.h (make_shared_ptr): Convenience function to make a shared pointer from a raw pointer. * cpp/src/tests/ClientChannelTest.cpp: Added message.get test. * cpp/src/tests/Makefile.am (check-unit): Added test-unit target to run unit tests. git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@525932 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/cpp/src/framing/Requester.h | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'qpid/cpp/src/framing/Requester.h') diff --git a/qpid/cpp/src/framing/Requester.h b/qpid/cpp/src/framing/Requester.h index dcc4460041..65bdc9a5a1 100644 --- a/qpid/cpp/src/framing/Requester.h +++ b/qpid/cpp/src/framing/Requester.h @@ -32,8 +32,7 @@ class AMQResponseBody; /** * Manage request IDs and the response mark for locally initiated requests. * - * THREAD UNSAFE: This class is called as frames are sent or received - * sequentially on a connection, so it does not need to be thread safe. + * THREAD UNSAFE: must be locked externally. */ class Requester { @@ -46,12 +45,14 @@ class Requester /** Called after processing a response. */ void processed(const AMQResponseBody::Data&); - /** Get the next request id to be used. */ - RequestId getNextId() { return lastId + 1; } - /** Get the first request acked by this response */ - RequestId getFirstAckRequest() { return firstAckRequest; } - /** Get the last request acked by this response */ - RequestId getLastAckRequest() { return lastAckRequest; } + /** Get the next request id to be used. */ + RequestId getNextId() { return lastId + 1; } + + /** Get the first request acked by last response */ + RequestId getFirstAckRequest() { return firstAckRequest; } + + /** Get the last request acked by last response */ + RequestId getLastAckRequest() { return lastAckRequest; } private: RequestId lastId; -- cgit v1.2.1