Trying to understand the idiom around tevent_req_defer_callback ...

Richard Sharpe realrichardsharpe at gmail.com
Mon Nov 2 21:56:44 UTC 2015


On Mon, Nov 2, 2015 at 1:40 PM, Jeremy Allison <jra at samba.org> wrote:
> On Mon, Nov 02, 2015 at 01:05:18PM -0800, Richard Sharpe wrote:
>> Hi folks,
>>
>> I came across this sequence in smbd_smb2_notify_reply:
>>
>>         tevent_req_defer_callback(req, state->smb2req->sconn->ev_ctx);
>>
>>         if (!NT_STATUS_IS_OK(state->status)) {
>>                 tevent_req_nterror(req, state->status);
>>                 return;
>>         }
>>
>>         tevent_req_done(req);
>>
>> In looking at _tevent_req_notify_callback it seems the function of
>> tevent_req_defer_callback is to ensure that the callback is not called
>> until we get back to the creator of this request and have given it a
>> chance set a callback.
>>
>> Do I have that correct or have I totally misunderstood?
>
> The docs...
>
> https://tevent.samba.org/group__tevent__request.html#ga09373077d0b39e321a196a86bfebf280

Yeah, I saw that documentation in the code, but it is worthless for
this case, it seems to me.

The documentation talks explicitly about multiple events and shows a
loop where tevent_req_done is being performed on multiple events, but
it does not seem like there are multiple events in the case of
smbd_smb2_notify_reply. Is the call to tevent_req_defer_callback
unneeded in this case?

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)



More information about the samba-technical mailing list