example_coro: make the callers simpler as tevent_coroutine_yield does the checks master4-tevent-coro
authorStefan Metzmacher <metze@samba.org>
Mon, 4 May 2009 10:24:35 +0000 (12:24 +0200)
committerStefan Metzmacher <metze@samba.org>
Thu, 17 May 2018 07:26:12 +0000 (09:26 +0200)
and bails out it self

metze

source4/ntvfs/ipc/vfs_ipc.c

index 09332bd5b490f47b235c7591afd04b5bfa89e6b0..e60de5f075d167f47a24eeb51e9c5a1b62205c8a 100644 (file)
@@ -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);