From: Ian Jackson Subject: Re: FW: Cancelling asynchronous operations in libxl Date: Thu, 31 Oct 2013 14:32:31 +0000 Message-ID: <21106.27135.289465.658185@mariner.uk.xensource.com> References: <4B8F5D33B081C044AA43634E84ED7F9616A83D@AMSPEX01CL03.citrite.net> <20131023172329.GE28413@phenom.dumpdata.com> <1382776392.22417.179.camel@hastur.hellion.org.uk> <21102.34850.365297.10422@mariner.uk.xensource.com> <1383227549.25018.60.camel@dagon.hellion.org.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1383227549.25018.60.camel@dagon.hellion.org.uk> 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 Campbell Cc: Simon Beaumont , "xs-devel@lists.xenserver.org" , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Ian Campbell writes ("Re: [Xen-devel] FW: Cancelling asynchronous operations in libxl"): > The way in which sequential async subops are currently handled (by > chaining callbacks) is a bit ugly -- it leads to weird error messages > like "libxl__vtpm_foo: Failed" which actually means "couldn't add a > NIC" (because that was the previous step, and libxl__vtpm_foo is what > picks up the result). Do you think it would be feasible to recast those > as sequences of function pointers in an array with a central (common) > dispatcher which steps through, handling and reporting errors? Hmmm. It might be. There's a problem in that they all tend to have different arguments. And the control flow would be split into two places. Maybe it would be better to improve the error reporting to not rely on the function name (which is TBH pretty pants anyway). > If things could be restructured along those lines then adding > cancellation support to the dispatcher might get us reasonably good API > coverage pretty easily Hmm. Writing the control flow of all of these in a declarative style would be difficult. There are a lot of ifs and some parallel loops, as well as simple sequential execution. I think we would be in danger of writing a full-on coroutine system. Maybe that wouldn't be such a bad idea. Hmm. Ian.