[PATCH] Make server-side copy (copy-chunk) async

Stefan Metzmacher metze at samba.org
Thu Mar 23 09:39:24 UTC 2017


Am 23.03.2017 um 02:52 schrieb Jeremy Allison via samba-technical:
> On Wed, Mar 22, 2017 at 10:47:59PM +0100, Ralph Böhme wrote:
>> On Wed, Mar 22, 2017 at 02:44:48PM -0700, Jeremy Allison wrote:
>>
>>> What about a tevent useage where a containing
>>> tevent_req issues a set of multiple async
>>> sub requests backed by underlying pthreads,
>>> or a it's using a tevent_queue ? It doesn't
>>> help cancelling them as there's more than
>>> one subreq we're waiting on.
>>
>> Sure, for the more complicated cases you need a full fledged cancel
>> functions. tevent_req_set_cancel_forwarding() is supposed to be used from
>> function that would otherwise don't need a cancel function at all.
>>
>>> Convince me ! :-) :-).
>>
>> With tevent_req_set_cancel_forwarding() it's one line of code instead of, well,
>> 10? I'm using it in four places, makes 40 lines less boilerplate code. Smaller
>> diff wins! :)
>>
>> I personally just *like* this API, but I guess I'm biased. :)
> 
> Fair enough - it is a convenience that eliminates
> quite a bit of boilerplate code.
> 
> I guess if Metze and Volker are OK with it I'll learn
> to live with it :-).

The fact that the cancel function passed
to tevent_req_set_cancel_fn() only gets the
tevent_req *req pointer, makes it impossible to write a generic
helper function on top of tevent.

I think tevent_req_set_cancel_forwarding() is easy to use for
all trivial cases where we do non parallel requests, which
is the majority of all use cases.

If someone has a more complex situation, it's only solvable
via a custom cancel function.

metze

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20170323/9d5f55a5/signature.sig>


More information about the samba-technical mailing list