Is the tevent tutorial correct?

Richard Sharpe realrichardsharpe at gmail.com
Thu Jan 22 08:37:39 MST 2015


On Wed, Jan 21, 2015 at 11:07 PM, Ralph Böhme <rb at sernet.de> wrote:
> Hi Richard
>
> On Wed, Jan 21, 2015 at 06:41:28AM -0800, Richard Sharpe wrote:
>> On Wed, Jan 21, 2015 at 6:38 AM, Andreas Schneider <asn at samba.org> wrote:
>> > On Tuesday 20 January 2015 20:48:28 Richard Sharpe wrote:
>> >> Hi folks,
>> >>
>> >> I was reading this page https://tevent.samba.org/tevent_data.html
>> >> prior to taking some people through this tomorrow, and I extracted the
>> >> code in the tutorial and ran it.
>> >>
>> >> The tutorial claims I should see this:
>> >> ----------
>> >> a->x: 9
>> >> b->y: 10
>> >> c->y: 10
>> >> ----------
>> >>
>> >> However, I see this:
>> >>
>> >> ---------------
>> >> _send
>> >> a->x: 10
>> >> b->y: 9
>> >> c->y: 9
>> >> Quit
>> >> ---------------
>> >
>> > Might be a typo in the tutorial. Great that someone looks into it.
>> > Improvements are very welcome!
>>
>> I am also trying to understand the intent. The comments suggest that
>> the three numbers are pulled from different instances of the state
>> variables but that does not seem to be the case.
>
>   Private data can be of 2 types: connected with a request itself or
>   given as an individual argument to a callback. It is necessary to
>   differentiate these types, because there is a slightly different
>   method of data access for each. There are two possibilities how to
>   access data that is given as an argument directly to a callback.
>
> There are two types where one type has two access possibilites, makes
> for three possibilities.
>
> Patch for the wrong exmaple output attached. Please review and push if
> ok.

Ahhh, I didn't see your patch when I constructed mine this morning.

However, I think there is still one thing wrong with the example from
a pedagogic point of view, which is that by setting up the value of
the data passed in from main to be the same value as that set in a
later function it creates confusion is someone's mind, perhaps mine.

There is also a white-space issue in the top-most call back. See my
patch from today which is essentially yours with a few more changes.

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


More information about the samba-technical mailing list