aboutsummaryrefslogtreecommitdiffstats
path: root/tools/libxl/libxl_event.c
diff options
context:
space:
mode:
authorIan Jackson <ian.jackson@eu.citrix.com>2012-05-17 14:45:40 +0100
committerIan Jackson <ian.jackson@eu.citrix.com>2012-05-17 14:45:40 +0100
commit79d00fc950e952a06fa986af6c58341705f06fac (patch)
treea5208a4e47ac27ced1215829d2749f1bf094fb65 /tools/libxl/libxl_event.c
parent8d204daa8f1d949092afbf4098d6e70bc40a3c20 (diff)
downloadxen-79d00fc950e952a06fa986af6c58341705f06fac.tar.gz
xen-79d00fc950e952a06fa986af6c58341705f06fac.tar.bz2
xen-79d00fc950e952a06fa986af6c58341705f06fac.zip
libxl: events: STATE_AO_GC checks ao is still valid
This will catch earlier the mistake where an ao is completed while it still has events registered: when the event callback happens for the long-gone ao, we will crash before attempting to execute any of the operation-specific code. Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com> Committed-by: Ian Campbell <ian.campbell@citrix.com>
Diffstat (limited to 'tools/libxl/libxl_event.c')
-rw-r--r--tools/libxl/libxl_event.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c
index 03d0498020..350e846aa4 100644
--- a/tools/libxl/libxl_event.c
+++ b/tools/libxl/libxl_event.c
@@ -1352,6 +1352,13 @@ void libxl__ao_abort(libxl__ao *ao)
libxl__ao__destroy(CTX, ao);
}
+libxl__gc *libxl__ao_inprogress_gc(libxl__ao *ao)
+{
+ assert(ao->magic == LIBXL__AO_MAGIC);
+ assert(!ao->complete);
+ return &ao->gc;
+}
+
void libxl__ao_complete(libxl__egc *egc, libxl__ao *ao, int rc)
{
assert(ao->magic == LIBXL__AO_MAGIC);