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
http://activemq.apache.org/cms/api_docs/activemqcpp-2.0.1/classactivemq_1_1concurrent_1_1_thread.html.


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 (
http://activemq.apache.org/cms/api_docs/activemqcpp-2.0.1/_concurrent_8h.html).
This lets you do things like this:

synchronized(this){
    ...
}

In addition, all Synchronizable objects (
http://activemq.apache.org/cms/api_docs/activemqcpp-2.0.1/classactivemq_1_1concurrent_1_1_synchronizable.html)
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 (
http://activemq.apache.org/cms/api_docs/activemqcpp-2.0.1/classactivemq_1_1concurrent_1_1_mutex.html).
That makes it really easy to make any class Synchronizable.

Hope that helps :)

Regards,
Nate

On 10/25/07, mrh <[EMAIL PROTECTED]> 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:
> http://www.nabble.com/Stop-Thread---Stop-Listening-tf4693571s2354.html#a13415697
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>

Reply via email to