You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@mynewt.apache.org by Sterling Hughes <st...@apache.org> on 2016/05/05 17:47:45 UTC

callout and callout_func

Salutations,

As I've been going through the callout implementation, one thing I've 
noticed is that callouts and callout_funcs can't be interleaved.

The implementation of a callout, is that it has an event as the first 
element of the structure.  When that event is posted to an event queue, 
it is posted with the event type EVENT_T_TIMER, which is reserved for 
callouts.  However, you must know a priori what type of callout it is, a 
callout, or a callout_func.

I don't think this behavior is ideal, and there are a couple of options 
for fixing it:

1- Break out EVENT_T_TIMER into EVENT_T_TIMER (callout) and 
EVENT_T_TIMER_FUNC (callout_func).

2- Remove the concept of callout, and just have callout_func. 
callout_func is by far the more useful of the two.

3- Add a flags field to callout, which will tell you whether its a 
callout or a callout_func.

I'm leaning towards either #2 or #3 here, because I think the first one 
will end up being confusing when debugging things.  "Oh no, I put TIMER 
instead of TIMER_FUNC. GRR."  My personal preference is #2, but I'm not 
sure everyone wants to be forced to have a function per-timer in their 
task context.

Thoughts?

Sterling

Re: callout and callout_func

Posted by Christopher Collins <cc...@apache.org>.
I also prefer #2.

Chris

On Fri, May 06, 2016 at 11:31:03AM -0700, will sanfilippo wrote:
> My vote would be #2 as well.
> 
> 
> > On May 6, 2016, at 11:29 AM, marko kiiskila <ma...@runtime.io> wrote:
> > 
> > Hi,
> > 
> >> On May 5, 2016, at 10:47 AM, Sterling Hughes <st...@apache.org> wrote:
> >> 
> >> Salutations,
> >> 
> >> As I've been going through the callout implementation, one thing I've noticed is that callouts and callout_funcs can't be interleaved.
> >> 
> >> The implementation of a callout, is that it has an event as the first element of the structure.  When that event is posted to an event queue, it is posted with the event type EVENT_T_TIMER, which is reserved for callouts.  However, you must know a priori what type of callout it is, a callout, or a callout_func.
> >> 
> >> I don't think this behavior is ideal, and there are a couple of options for fixing it:
> >> 
> >> 1- Break out EVENT_T_TIMER into EVENT_T_TIMER (callout) and EVENT_T_TIMER_FUNC (callout_func).
> >> 
> >> 2- Remove the concept of callout, and just have callout_func. callout_func is by far the more useful of the two.
> >> 
> >> 3- Add a flags field to callout, which will tell you whether its a callout or a callout_func.
> >> 
> >> I'm leaning towards either #2 or #3 here, because I think the first one will end up being confusing when debugging things.  "Oh no, I put TIMER instead of TIMER_FUNC. GRR."  My personal preference is #2, but I'm not sure everyone wants to be forced to have a function per-timer in their task context.
> >> 
> >> Thoughts?
> > 
> > I would prefer #2, as that would simplify the concept.
> > 
> > Also, while you have that file cracked open, cf_arg from within os_callout_func could be removed.
> > os_callout includes os_event, and that structure already has a void * which could be used as callout_func
> > argument.
> > \u2014
> > M
> 

Re: callout and callout_func

Posted by will sanfilippo <wi...@runtime.io>.
My vote would be #2 as well.


> On May 6, 2016, at 11:29 AM, marko kiiskila <ma...@runtime.io> wrote:
> 
> Hi,
> 
>> On May 5, 2016, at 10:47 AM, Sterling Hughes <st...@apache.org> wrote:
>> 
>> Salutations,
>> 
>> As I've been going through the callout implementation, one thing I've noticed is that callouts and callout_funcs can't be interleaved.
>> 
>> The implementation of a callout, is that it has an event as the first element of the structure.  When that event is posted to an event queue, it is posted with the event type EVENT_T_TIMER, which is reserved for callouts.  However, you must know a priori what type of callout it is, a callout, or a callout_func.
>> 
>> I don't think this behavior is ideal, and there are a couple of options for fixing it:
>> 
>> 1- Break out EVENT_T_TIMER into EVENT_T_TIMER (callout) and EVENT_T_TIMER_FUNC (callout_func).
>> 
>> 2- Remove the concept of callout, and just have callout_func. callout_func is by far the more useful of the two.
>> 
>> 3- Add a flags field to callout, which will tell you whether its a callout or a callout_func.
>> 
>> I'm leaning towards either #2 or #3 here, because I think the first one will end up being confusing when debugging things.  "Oh no, I put TIMER instead of TIMER_FUNC. GRR."  My personal preference is #2, but I'm not sure everyone wants to be forced to have a function per-timer in their task context.
>> 
>> Thoughts?
> 
> I would prefer #2, as that would simplify the concept.
> 
> Also, while you have that file cracked open, cf_arg from within os_callout_func could be removed.
> os_callout includes os_event, and that structure already has a void * which could be used as callout_func
> argument.
> —
> M


Re: callout and callout_func

Posted by marko kiiskila <ma...@runtime.io>.
Hi,

> On May 5, 2016, at 10:47 AM, Sterling Hughes <st...@apache.org> wrote:
> 
> Salutations,
> 
> As I've been going through the callout implementation, one thing I've noticed is that callouts and callout_funcs can't be interleaved.
> 
> The implementation of a callout, is that it has an event as the first element of the structure.  When that event is posted to an event queue, it is posted with the event type EVENT_T_TIMER, which is reserved for callouts.  However, you must know a priori what type of callout it is, a callout, or a callout_func.
> 
> I don't think this behavior is ideal, and there are a couple of options for fixing it:
> 
> 1- Break out EVENT_T_TIMER into EVENT_T_TIMER (callout) and EVENT_T_TIMER_FUNC (callout_func).
> 
> 2- Remove the concept of callout, and just have callout_func. callout_func is by far the more useful of the two.
> 
> 3- Add a flags field to callout, which will tell you whether its a callout or a callout_func.
> 
> I'm leaning towards either #2 or #3 here, because I think the first one will end up being confusing when debugging things.  "Oh no, I put TIMER instead of TIMER_FUNC. GRR."  My personal preference is #2, but I'm not sure everyone wants to be forced to have a function per-timer in their task context.
> 
> Thoughts?

I would prefer #2, as that would simplify the concept.

Also, while you have that file cracked open, cf_arg from within os_callout_func could be removed.
os_callout includes os_event, and that structure already has a void * which could be used as callout_func
argument.
—
M