return;
}
- tevent_debug(im->event_ctx, TEVENT_DEBUG_TRACE,
- "Cancel immediate event %p \"%s\"\n",
- im, im->handler_name);
+ if (im->handler_name != NULL) {
+ tevent_debug(im->event_ctx, TEVENT_DEBUG_TRACE,
+ "Cancel immediate event %p \"%s\"\n",
+ im, im->handler_name);
+ }
/* let the backend free im->additional_data */
if (im->cancel_fn) {
while (ev->scheduled_immediates != NULL) {
struct tevent_immediate *im = ev->scheduled_immediates;
+ struct tevent_immediate copy = *im;
+
DLIST_REMOVE(ev->scheduled_immediates, im);
- DLIST_ADD_END(ev->immediate_events, im);
+
+ tevent_debug(ev, TEVENT_DEBUG_TRACE,
+ "Schedule immediate event \"%s\": %p from thread into main\n",
+ im->handler_name, im);
+ im->handler_name = NULL;
+ _tevent_schedule_immediate(im,
+ ev,
+ copy.handler,
+ copy.private_data,
+ copy.handler_name,
+ copy.schedule_location);
}
ret = pthread_mutex_unlock(&ev->scheduled_mutex);