From: Wei Liu Subject: Re: [PATCH 20/35] libxl: ao abort: Provide public ao abort request API Date: Fri, 26 Jun 2015 15:47:42 +0100 Message-ID: <20150626144742.GG6265@zion.uk.xensource.com> References: <1435254275-8184-1-git-send-email-ian.jackson@eu.citrix.com> <1435254275-8184-21-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <1435254275-8184-21-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: Wei Liu , xen-devel@lists.xensource.com, Euan Harris , Ian Campbell List-Id: xen-devel@lists.xenproject.org On Thu, Jun 25, 2015 at 06:44:20PM +0100, Ian Jackson wrote: [...] > + * It is possible to abort even an operation which is being performed > + * synchronously, but since in that case how==NULL you had better only > + * have one such operation, because it is not possible to tell them > + * apart. (And, if you want to do this, obviously the abort would > + * have to be requested on a different thread.) > + */ > +int libxl_ao_abort(libxl_ctx *ctx, const libxl_asyncop_how *how) > + LIBXL_EXTERNAL_CALLERS_ONLY; > + > + > #define LIBXL_VERSION 0 > [...] > + > +int libxl_ao_abort(libxl_ctx *ctx, const libxl_asyncop_how *how) > +{ > + libxl__ao *search; > + libxl__ctx_lock(ctx); > + int rc; > + > + LIBXL_LIST_FOREACH(search, &ctx->aos_inprogress, inprogress_entry) { > + if (how) { > + /* looking for ao to be reported by callback or event */ > + if (search->poller) > + /* sync */ > + continue; > + if (how->callback != search->how.callback) > + continue; > + if (how->callback > + ? (how->u.for_callback != search->how.u.for_callback) > + : (how->u.for_event != search->how.u.for_event)) > + continue; > + } else { > + /* looking for synchronous call */ > + if (!search->poller) > + /* async */ > + continue; > + } I interpreted the doc more like "it aborts all sync operations". This function only aborts the first synchronous operation it finds. The doc didn't make this clear. Wei.