From: Stefan Metzmacher Date: Mon, 4 May 2009 10:24:35 +0000 (+0200) Subject: example_coro: make the callers simpler as tevent_coroutine_yield does the checks X-Git-Url: http://git.samba.org/?p=metze%2Fsamba%2Fwip.git;a=commitdiff_plain;h=refs%2Fheads%2Fmaster4-tevent-coro example_coro: make the callers simpler as tevent_coroutine_yield does the checks and bails out it self metze --- diff --git a/source4/ntvfs/ipc/vfs_ipc.c b/source4/ntvfs/ipc/vfs_ipc.c index 09332bd5b490..e60de5f075d1 100644 --- a/source4/ntvfs/ipc/vfs_ipc.c +++ b/source4/ntvfs/ipc/vfs_ipc.c @@ -676,12 +676,13 @@ static struct tevent_coroutine_result *example_ocor_body(struct tevent_coroutine DEBUG(0,("%s[%p]: 1. %s\n", __location__, coro, state->string)); subreq = tevent_wakeup_send(state, ev, timeval_current_ofs(0,500)); - if (tevent_coroutine_nomem(subreq, coro)) { - return tevent_coroutine_return(coro); - } tevent_coroutine_yield(coro, subreq); ok = tevent_wakeup_recv(subreq); TALLOC_FREE(subreq); + if (!ok) { + tevent_coroutine_error(coro, ENOTSUP); + return tevent_coroutine_return(coro); + } DEBUG(0,("%s[%p]: 2. %s wakeup[%d]\n", __location__, coro, state->string, ok)); @@ -747,9 +748,6 @@ static struct tevent_coroutine_result *example_coro_body(struct tevent_coroutine DEBUG(0,("%s:%s[%p]: 1. %s\n", __location__, __FUNCTION__, coro, state->string)); 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); @@ -761,9 +759,6 @@ static struct tevent_coroutine_result *example_coro_body(struct tevent_coroutine 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);