From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=47213 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6Qco-0001fm-B6 for qemu-devel@nongnu.org; Thu, 14 Oct 2010 12:25:51 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P6QTr-0005m4-To for qemu-devel@nongnu.org; Thu, 14 Oct 2010 12:16:36 -0400 Received: from mx1.redhat.com ([209.132.183.28]:63560) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P6QTr-0005lt-Mp for qemu-devel@nongnu.org; Thu, 14 Oct 2010 12:16:35 -0400 Message-ID: <4CB72CDC.1010206@redhat.com> Date: Thu, 14 Oct 2010 18:16:28 +0200 From: Avi Kivity MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/3] Introduce threadlets References: <20101013152921.21735.87339.stgit@localhost6.localdomain6> <20101013153110.21735.16669.stgit@localhost6.localdomain6> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Arun R Bharadwaj , qemu-devel@nongnu.org On 10/14/2010 11:15 AM, Stefan Hajnoczi wrote: > I forgot to add that the semantics of cancellation make it difficult > to write correct user code. Every cancellation user needs to add > extra synchronization after the cancel call to handle the case where > the work is currently executing. > > This seems tricky to me and I suspect code using this interface will > be buggy. How about the following? > 1. Add a return value indicating that the work is currently executing > (this still requires the caller to add extra synchronization but is at > least explicit) versus work is no longer on the list. > 2. Add a flag to block until the work has been cancelled or completed. > This is useful to callers who are allowed to block. Blocking is somewhat against the spirit of the thing, no? While I agree that the current cancel API is hard to use correctly, blocking defeats the purpose of the API. -- error compiling committee.c: too many arguments to function