[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] libxl: events: Document and enforce actual callbacks restriction
commit 60ce518a1b1caf2c1e4c1b203e87fb0b179ba687 Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> AuthorDate: Wed Nov 26 17:28:18 2014 +0000 Commit: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx> CommitDate: Wed Dec 10 13:48:31 2014 +0000 libxl: events: Document and enforce actual callbacks restriction libxl_event_register_callbacks cannot reasonably be called while libxl is busy (has outstanding operations and/or enabled events). This is because the previous spec implied (although not entirely clearly) that event hooks would not be called for existing fd and timeout interests. There is thus no way to reliably ensure that libxl would get told about fds and timeouts which it became interested in beforehand. So there have to be no such fds or timeouts, which means that the callbacks must only be registered or changed when the ctx is idle. Document this restriction, and enforce it with a pair of asserts. (It would be nicer, perhaps, to say that the application may not call libxl_osevent_register_hooks other than right after creating the ctx. But there are existing callers, including libvirt, who do it later - even after doing major operations such as domain creation.) Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Tested-by: Ian Campbell <ian.campbell@xxxxxxxxxx> Release-Acked-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx> --- tools/libxl/libxl_event.c | 2 ++ tools/libxl/libxl_event.h | 6 ++---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c index a36e6d9..0d874d9 100644 --- a/tools/libxl/libxl_event.c +++ b/tools/libxl/libxl_event.c @@ -1219,6 +1219,8 @@ void libxl_osevent_register_hooks(libxl_ctx *ctx, { GC_INIT(ctx); CTX_LOCK; + assert(LIBXL_LIST_EMPTY(&ctx->efds)); + assert(LIBXL_TAILQ_EMPTY(&ctx->etimes)); ctx->osevent_hooks = hooks; ctx->osevent_user = user; CTX_UNLOCK; diff --git a/tools/libxl/libxl_event.h b/tools/libxl/libxl_event.h index b5db83c..3c6fcfe 100644 --- a/tools/libxl/libxl_event.h +++ b/tools/libxl/libxl_event.h @@ -124,10 +124,8 @@ void libxl_event_register_callbacks(libxl_ctx *ctx, * different parameters, as the application likes; the most recent * call determines the libxl behaviour. However it is NOT safe to * call _register_callbacks concurrently with, or reentrantly from, - * any other libxl function. - * - * Calls to _register_callbacks do not affect events which have - * already occurred. + * any other libxl function, nor while any event-generation + * facilities are enabled. */ -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |