Hi,

You get the timeout functionality by adding an timeout event on your own
to get the same functionality. Would not be a big burden.

However, this kind of convenience function should be ok. You could
even have that guy implement it this way, as opposed to adding additional
code to eventq_get() itself.

I don’t think the select() kind of mask is a good idea. eventq_XXX is more
like kqueue() rather than select(). I don’t think there are that many places
where you’d want to mask out some events and not others. Especially
as this’ll mean that there will presumably will mean that events will get
delivered out of order.

> On Apr 4, 2016, at 9:13 AM, will sanfilippo <[email protected]> wrote:
> 
> I would not break BC; I would add a different function. Not sure what I would 
> call it but wouldnt it just have a timeout, in ticks, associated with it? For 
> example: os_eventq_wait(&my_evq, timeout_in_os_ticks). What is the purpose of 
> the mask btw? Something to do with returning an error if it times out or some 
> way of selecting particular events?
> 
> Will
> 
>> On Apr 4, 2016, at 8:14 AM, Sterling Hughes <[email protected]> wrote:
>> 
>> Hey,
>> 
>> I'm looking at: https://issues.apache.org/jira/browse/MYNEWT-8
>> 
>> I'm wondering if I should break BC on this one, and add a new parameter, or 
>> add a new function call:
>> 
>> - os_eventq_select()
>> 
>> OS_EVENTQ_MASK(my_mask, EVENT_T_TIMER);
>> OS_EVENTQ_MASK(my_mask, EVENT_T_DATA);
>> 
>> /* timeout after 200 ticks */
>> ev = os_eventq_select(&my_evq, &my_mask, 200);
>> 
>> Thoughts?
>> 
>> Sterling
>> 
>> PS: For the uninitiated, os_eventq_get() works as follows.
>> 
>> In your task, you create an eventq with os_eventq_init(), and then you wait 
>> (forever) on os_eventq_get().
>> 
>> If you (currently) want to not wait forever, you can use a callout, which 
>> will post an event to the eventq after a certain time expires.
>> 
>> while (1) {
>>   ev = os_eventq_get(&my_evq);
>>   switch (ev->ev_type) {
>>       case EVENT_T_DATA: /* read data from socket */
>>        recv_data();
>>       case EVENT_T_TIMER: /* timer expired */
>>        os_callout_reset(&my_callout, &my_evq, 20);
>>   }
>> }
> 

Reply via email to