[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 2/2] call ao_how callback explicitly
ao_how callback is not called after inserted into list. in my test, i directly call it in libxl__ao_complete_check_progress_reports. i know it should not work like this. Could you give some suggestion about it? Signed-off-by: Bamvor Jian Zhang <bjzhang@xxxxxxxx> --- tools/libxl/libxl_event.c | 18 ++++++++++++++++++ tools/libxl/libxl_internal.h | 1 + 2 files changed, 19 insertions(+) diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c index 0fe4428..8320547 100644 --- a/tools/libxl/libxl_event.c +++ b/tools/libxl/libxl_event.c @@ -1578,6 +1578,23 @@ void libxl__ao_complete(libxl__egc *egc, libxl__ao *ao, int rc) libxl__ao_complete_check_progress_reports(egc, ao); } +void libxl__ao_occurred(libxl__egc *egc) +{ + EGC_GC; + libxl__ao *ao, *ao_tmp; + LIBXL_TAILQ_FOREACH_SAFE(ao, &egc->aos_for_callback, + entry_for_callback, ao_tmp) { + LIBXL_TAILQ_REMOVE(&egc->aos_for_callback, ao, entry_for_callback); + LOG(DEBUG,"ao %p: completion callback", ao); + ao->how.callback(CTX, ao->rc, ao->how.u.for_callback); + CTX_LOCK; + ao->notified = 1; + if (!ao->in_initiator) + libxl__ao__destroy(CTX, ao); + CTX_UNLOCK; + } +} + void libxl__ao_complete_check_progress_reports(libxl__egc *egc, libxl__ao *ao) { /* @@ -1601,6 +1618,7 @@ void libxl__ao_complete_check_progress_reports(libxl__egc *egc, libxl__ao *ao) } else if (ao->how.callback) { LIBXL__LOG(ctx, XTL_DEBUG, "ao %p: complete for callback",ao); LIBXL_TAILQ_INSERT_TAIL(&egc->aos_for_callback, ao, entry_for_callback); + libxl__ao_occurred(egc); } else { libxl_event *ev; ev = NEW_EVENT(egc, OPERATION_COMPLETE, ao->domid, ao->how.u.for_event); diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h index 4f92522..bed775d 100644 --- a/tools/libxl/libxl_internal.h +++ b/tools/libxl/libxl_internal.h @@ -1760,6 +1760,7 @@ _hidden int libxl__ao_inprogress(libxl__ao *ao, const char *file, int line, const char *func); /* temporarily unlocks */ _hidden void libxl__ao_abort(libxl__ao *ao); _hidden void libxl__ao_complete(libxl__egc *egc, libxl__ao *ao, int rc); +_hidden void libxl__ao_occurred(libxl__egc *egc); _hidden libxl__gc *libxl__ao_inprogress_gc(libxl__ao *ao); /* Can be called at any time. Use is essential for any aop user. */ -- 1.8.1.4 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |