From: Ian Campbell Subject: Re: [PATCH 21/28] libxl: ocaml: add wrappers for poll Date: Tue, 23 Apr 2013 14:43:51 +0100 Message-ID: <1366724631.20256.151.camel@zakaz.uk.xensource.com> References: <1364222729-6982-1-git-send-email-rob.hoes@citrix.com> <1364222729-6982-22-git-send-email-rob.hoes@citrix.com> <1365683460.8036.93.camel@zakaz.uk.xensource.com> <7EA643C653F17F4C80DE959E978F10ED010F729E0192@LONPMAILBOX01.citrite.net> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <7EA643C653F17F4C80DE959E978F10ED010F729E0192@LONPMAILBOX01.citrite.net> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Rob Hoes Cc: "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On Tue, 2013-04-23 at 14:37 +0100, Rob Hoes wrote: > > Other than Dave's comment it looks good to me. > > > > But how does the event model work in your callers today? The intention > > with the libxl event interface is that by implementing the right hooks to > > register/deregister fds you can just continue to use your existing event loop > > (presuming it can take events on fds). > > I have been experimenting with two different ways of doing this. > > Xenopsd does not yet have an fd polling loop that we can easily use > for libxl events. For this reason I just wrapped the poll function > myself and ran it separately. The other option is to use a library > such as Lwt (http://ocsigen.org/lwt/), which does have an event loop > we can easily integrate with, and I got the libxl fd registration > stuff working with this in a test program. > > The problem with the latter approach is that it requires quite a > rather big rewrite of xenopsd in order to use Lwt (or a something > similar), and we did not have time for that yet (we probably will at > some point). Ah, so the use of poll is really just a short term pragmatic one until you get around to implementing Lwt support? That sounds reasonable. I seem to recall hearing that Lwt was on the roadmap for many of the xen-api ocaml bits (e.g. oxenstored) too. I think I'd be happier if this poll interface was part of xenopsd itself rather than part of the libxl ocaml bindings, where it runs the risk of becoming a stable & supported interface of the Xen project. Or if you cannot include it in xenopsd perhaps it fits better in some other dependency? I thought ocaml had a posix functionality library? (unix or stdext or something). Failing all that I suppose we could live with tools/ocaml/libs/poll in the Xen tree. (aside: I'd really love it if tools/ocaml/libs/mmap could find a non-Xen home too ;-)) Ian.