From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=53095 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OMfh0-0001Wd-GC for qemu-devel@nongnu.org; Thu, 10 Jun 2010 07:13:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OMfgz-0001cD-8K for qemu-devel@nongnu.org; Thu, 10 Jun 2010 07:13:02 -0400 Received: from e28smtp09.in.ibm.com ([122.248.162.9]:44859) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OMfgy-0001bF-Ha for qemu-devel@nongnu.org; Thu, 10 Jun 2010 07:13:01 -0400 Received: from d28relay05.in.ibm.com (d28relay05.in.ibm.com [9.184.220.62]) by e28smtp09.in.ibm.com (8.14.4/8.13.1) with ESMTP id o5AABJR3026448 for ; Thu, 10 Jun 2010 15:41:19 +0530 Received: from d28av04.in.ibm.com (d28av04.in.ibm.com [9.184.220.66]) by d28relay05.in.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id o5ABCsnc2179240 for ; Thu, 10 Jun 2010 16:42:54 +0530 Received: from d28av04.in.ibm.com (loopback [127.0.0.1]) by d28av04.in.ibm.com (8.14.4/8.13.1/NCO v10.0 AVout) with ESMTP id o5ABCrfH022236 for ; Thu, 10 Jun 2010 21:12:54 +1000 Date: Thu, 10 Jun 2010 16:42:50 +0530 From: Gautham R Shenoy Subject: Re: [Qemu-devel] Re: [PATCH V3 1/3] qemu: Add qemu-wrappers for pthread_attr_t Message-ID: <20100610111250.GB11253@in.ibm.com> References: <20100603085223.25546.88499.stgit@localhost.localdomain> <20100603085618.25546.99966.stgit@localhost.localdomain> <4C07A093.8020907@redhat.com> <4C08FAA3.5020502@codemonkey.ws> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable Reply-To: ego@in.ibm.com List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Corentin Chary Cc: Paolo Bonzini , Avi Kivity , Qemu-development List On Fri, Jun 04, 2010 at 03:19:34PM +0200, Corentin Chary wrote: > On Fri, Jun 4, 2010 at 3:07 PM, Anthony Liguori = wrote: > > On 06/03/2010 07:31 AM, Paolo Bonzini wrote: > >> > >> On 06/03/2010 10:56 AM, Gautham R Shenoy wrote: > >>> > >>> Add qemu wrappers for pthread_attr_t handling. > >> > >> The point of these wrappers AFAIU is not only to add error_exit, but= also > >> to be portable to Windows in the future. =A0Is it necessary to creat= e the > >> threads as detached? =A0If you set queue->min_threads to zero all th= reads > >> should exit as soon as they finish their work (which is better than = exiting > >> immediately). > > > > This is historical because the code was largely inspired by glibc's > > implementation of posix-aio. =A0It doesn't need to be detached and si= nce > > Corentin wants to be able to join a worker, it makes sense to just av= oid > > detaching and pay the overhead of making the threads joinable. > > > > Regards, > > > > Anthony Liguori > Sorry for the late response. I had been away for the last few days. > Actually, I want to know if the queue is empty and if no job are > currently being processed: all worker are idle or stopped. In other words, you just want to know if the already submitted jobs have gotten over or not so that you could probably destroy the queue. The subsystem using the queueing infrastructure is responsible for provid= ing the guarantee that no new job would be submitted while/after making a cal= l query the idleness of the queue. If this understanding is correct, we might want to have a qemu_async_barrier() implementation which waits for all the threads finish processing the queued jobs, and destroy themselves. >I don't really need pthread_join() for that, since worker can be idle (w= e > don't want to always start and stop the thread :) ). --=20 Thanks and Regards gautham