struct tevent_req *subreq,
const char *location)
{
+ if (subreq == NULL) {
+ tco->result.state = TEVENT_COROUTINE_NO_MEMORY;
+ tco->result.location = location;
+ tco->result.return_location = location;
+ /*
+ * this jumps back to tevent_coroutine_run() after
+ * co_call().
+ */
+ tco->coro = NULL;
+ co_exit();
+ return;
+ }
+
tco->result.state = TEVENT_COROUTINE_YIELD;
tco->result.location = location;
}
tevent_coroutine_yield(coro, subreq);
ok = tevent_wakeup_recv(subreq);
+ TALLOC_FREE(subreq);
DEBUG(0,("%s[%p]: 2. %s wakeup[%d]\n", __location__, coro, state->string, ok));
}
tevent_coroutine_yield(coro, subreq);
ret = example_ocor_recv(subreq, &sys_errno);
+ TALLOC_FREE(subreq);
if (ret == -1) {
tevent_coroutine_error(coro, sys_errno);
return tevent_coroutine_return(coro);
DEBUG(0,("%s:%s[%p]: 2. %s example_ocor[%d]\n", __location__, __FUNCTION__, coro, state->string, ret));
+ subreq = example_ocor_send(state, ev, state->string);
+ if (tevent_coroutine_nomem(subreq, coro)) {
+ return tevent_coroutine_return(coro);
+ }
+ tevent_coroutine_yield(coro, subreq);
+ ret = example_ocor_recv(subreq, &sys_errno);
+ TALLOC_FREE(subreq);
+ if (ret == -1) {
+ tevent_coroutine_error(coro, sys_errno);
+ return tevent_coroutine_return(coro);
+ }
+
+ DEBUG(0,("%s:%s[%p]: 3. %s example_ocor[%d]\n", __location__, __FUNCTION__, coro, state->string, ret));
+
tevent_coroutine_done(coro);
return tevent_coroutine_return(coro);
}