example_coro: make the callers simpler as tevent_coroutine_yield does the checks
authorStefan Metzmacher <metze@samba.org>
Mon, 4 May 2009 10:24:35 +0000 (12:24 +0200)
committerStefan Metzmacher <metze@samba.org>
Mon, 22 Apr 2013 09:21:47 +0000 (11:21 +0200)
and bails out it self

metze

source4/ntvfs/ipc/vfs_ipc.c

index de51533c38b92a20df1fe5019e3d291b14041856..fd45a6dbb1608fe347df098e233b437d7c859c0d 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);