activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Nathan Mittler" <>
Subject Re: Stop Thread / Stop Listening
Date Thu, 25 Oct 2007 21:09:51 GMT
Not sure I understand your question exactly.  Are you looking to simply use
the threading classes in your own program or are you asking  about how to
shutdown a connection?

If the latter, you simply have to do a connection.close().

If you're looking to use ActiveMQ-CPP's threading classes in your program,
this should give you an idea of what you can do

We basically took a Java approach.  Stopping threads is an
application-specific operation, so you have to write that logic yourself (
e.g. setting a flag/event).

BTW, we also have a synchronized macro that simulates the Java synchronized
block (
This lets you do things like this:


In addition, all Synchronizable objects (
allow you to do Java-style wait and notify as well.  Of course the object
has to first be locked before you can wait/notify on it.  If you have a
class that implements Synchronizable, you can just delegate all of the
Synchronizable methods to a member variable of type Mutex (
That makes it really easy to make any class Synchronizable.

Hope that helps :)


On 10/25/07, mrh <> wrote:
> With the threading capabilities provided by ActiveMQ-CPP, is it possible
> to
> stop a thread?  For example, if one thread starts listening for messages,
> is
> it possible for a second thread, say a command prompt to stop and shutdown
> the listener thread when the user types "quit" or "exit"?
> Thanks,
> mrh
> --
> View this message in context:
> Sent from the ActiveMQ - User mailing list archive at

  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message