Some places in libxl which can't handle abort via a
libxl__ao_abortable callback might nevertheless benefit from being
able to explicitly check whether abort has been requested.
Provide the (fairly trivial) internal API function to do this.
Signed-off-by: Ian Jackson <Ian.Jackson@eu.citrix.com>
Acked-by: Ian Campbell <ian.campbell@citrix.com>
---
v2: New in this version of the series.
return rc;
}
+int libxl__ao_aborting(libxl__ao *ao)
+{
+ libxl__ao *root = ao_nested_root(ao);
+ if (root->aborting) {
+ DBG("ao=%p: aborting at explicit check (root=%p)", ao, root);
+ return ERROR_ABORTED;
+ }
+
+ return 0;
+}
+
int libxl__ao_abortable_register(libxl__ao_abortable *abrt)
{
libxl__ao *ao = abrt->ao;
static inline bool libxl__ao_abortable_isregistered
(const libxl__ao_abortable *c) { return c->registered; }
+int libxl__ao_aborting(libxl__ao *ao); /* -> 0 or ERROR_ABORTED */
+
typedef struct libxl__ev_time libxl__ev_time;
typedef void libxl__ev_time_callback(libxl__egc *egc, libxl__ev_time *ev,