Return-Path: Delivered-To: apmail-activemq-users-archive@www.apache.org Received: (qmail 27618 invoked from network); 25 Oct 2007 21:13:33 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 25 Oct 2007 21:13:33 -0000 Received: (qmail 9612 invoked by uid 500); 25 Oct 2007 21:11:26 -0000 Delivered-To: apmail-activemq-users-archive@activemq.apache.org Received: (qmail 9592 invoked by uid 500); 25 Oct 2007 21:11:25 -0000 Mailing-List: contact users-help@activemq.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@activemq.apache.org Delivered-To: mailing list users@activemq.apache.org Received: (qmail 9583 invoked by uid 99); 25 Oct 2007 21:11:25 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Oct 2007 14:11:25 -0700 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of nathan.mittler@gmail.com designates 209.85.146.183 as permitted sender) Received: from [209.85.146.183] (HELO wa-out-1112.google.com) (209.85.146.183) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 25 Oct 2007 21:11:27 +0000 Received: by wa-out-1112.google.com with SMTP id k22so797787waf for ; Thu, 25 Oct 2007 14:09:52 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=RLi3SIIYvw1LWdNPJQIO4qpOiXtRv8tgieuZNM8agCU=; b=XZo2AVIwwYxJat0oojpjVpZRDSE3QSq3jzC1XSPj6xZLSQsSAxqxF03xuvbB1IPTwNP9l+sAqBCo0BSNL3C5u8qBTngGTZd6Ydr2/yP5+QHA49DNnKEWbAAuq3LtA7kriKhaFMaTO7KRNCnr6SFn2xNzQ5jPcvTjU7/TwW5TKxI= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=fL9iA39ZJmt7Hdi07TvhDaa/Q5Ap/5scGcuTAbvT4ezISgePLIu4IDjq8ic7AMfDhfukgONXaw8ycvTUnbpd/D927I7XFoPB9TO0ffKir2Q4MncJX603bj5CaQcOKeojdHdUYlFeoeaK2lwI4u9+mJKXOCj/Ec0zuhjQpBmqrDQ= Received: by 10.115.89.1 with SMTP id r1mr2584733wal.1193346591530; Thu, 25 Oct 2007 14:09:51 -0700 (PDT) Received: by 10.115.73.18 with HTTP; Thu, 25 Oct 2007 14:09:51 -0700 (PDT) Message-ID: <8a6feb940710251409s30ca00d9td71a0625f675fe70@mail.gmail.com> Date: Thu, 25 Oct 2007 17:09:51 -0400 From: "Nathan Mittler" To: users@activemq.apache.org Subject: Re: Stop Thread / Stop Listening In-Reply-To: <13415697.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_4242_5566126.1193346591509" References: <13415697.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_4242_5566126.1193346591509 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 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. > > ------=_Part_4242_5566126.1193346591509--