|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] libxl: provide STATE_AO_GC
# HG changeset patch
# User Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
# Date 1334150058 -3600
# Node ID d196634484a9f86136704f973293925445961079
# Parent 8a88f6e209dbecfeb0426970540df22351f74fe4
libxl: provide STATE_AO_GC
Provide a convenience macro for use in ao callback functions, and
document that it should be used.
Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx>
Committed-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
diff -r 8a88f6e209db -r d196634484a9 tools/libxl/libxl_internal.h
--- a/tools/libxl/libxl_internal.h Wed Apr 11 14:14:18 2012 +0100
+++ b/tools/libxl/libxl_internal.h Wed Apr 11 14:14:18 2012 +0100
@@ -1266,9 +1266,10 @@ _hidden void libxl__egc_cleanup(libxl__e
* - Note that during callback functions, two gcs are available:
* - The one in egc, whose lifetime is only this callback
* - The one in ao, whose lifetime is the asynchronous operation
- * Usually callback function should use CONTAINER_OF
- * to obtain its own structure, containing a pointer to the ao,
- * and then use the gc from that ao.
+ * Usually callback function should use CONTAINER_OF to obtain its
+ * own state structure, containing a pointer to the ao. It should
+ * then obtain the ao and use the ao's gc; this is most easily done
+ * using the convenience macro STATE_AO_GC.
*/
#define AO_CREATE(ctx, domid, ao_how) \
@@ -1298,6 +1299,10 @@ _hidden void libxl__egc_cleanup(libxl__e
#define AO_GC \
libxl__gc *const gc = &ao->gc
+#define STATE_AO_GC(op_ao) \
+ libxl__ao *const ao = (op_ao); \
+ AO_GC
+
/* All of these MUST be called with the ctx locked.
* libxl__ao_inprogress MUST be called with the ctx locked exactly once. */
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |