[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-API] [Xen-devel] [PATCH 10 of 15] libxc/ocaml: Add simple binding for xentoollog (output only)
On 29 Nov 2012, at 18:03, Ian Campbell <Ian.Campbell@xxxxxxxxxx> wrote: > > Another idea might be to make the bindings use the async interfaces > wherever possible by default, by definition anything potentially > blocking has supports this and that would avoid the need for > enter/leave, but at the expense of making the ocaml callers ugly > perhaps? Or maybe this sort of thing ends up looking very natural in > ocaml? Depends on your application's event mechanism I suspect. > > Last half witted idea: everything could be async but the bindings > include the loop to wait for the async event, i.e. effectively making > the call sync again. This sounds silly but it might allow better control > over the placement of enter/leave vs callbacks, since you would just > drop it over libxl_event_wait? Making everything explicitly async and non-blocking is by far the preferred solution in terms of stability, as it largely removes the need to worry about the GC interface and thread interactions. There are several libraries to wrap async interfaces in convenient synchronous programming, most notably Lwt (http://ocsigen.org/lwt). With this interface, all the OCaml callbacks are implemented in OCaml, and it just needs a select/epoll or equivalent to wake up sleeping threads when an IO event occurs. Dave has already done some bindings to Lwt, so I've CCed him... -anil _______________________________________________ Xen-api mailing list Xen-api@xxxxxxxxxxxxx http://lists.xen.org/cgi-bin/mailman/listinfo/xen-api
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |