[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [sc-dev] Timers



BeatSched does this.  Cancellable and has a more extensive interface than sched with the clock.

It doesn't cancel an individual item though, but it can cancel everything in it's channel.  And multiple beat sched can be created, they are lightweight.

Best way I think is to have a flag on the item and then when it comes due to only execute it if it's not flagged as cancelled.  You could argue its more efficient to search the pq and find it and remove it.   It depends on how often you cancel.



On Sunday, December 30, 2012, Jonatan Liljedahl wrote:
There's also the case of stopping a periodic timer, then it's not only
enough to disable the evaluation of a function.

Surely one can combine stuff to get a cancelable timer, but that would
never be as straight forward as a dedicated timer class.

Another solution would be to add the ability to unschedule an item
previously scheduled on a clock. I think it would work by popping all
items from the prioQ, and discard the one to be removed, and push the
rest back again. This might be a good thing to have anyway, even if we
add a dedicated simple timer class.


On Sun, Dec 30, 2012 at 4:58 AM, Scott Wilson <s.d.wilson@xxxxxxxxxx> wrote:
> Perhaps something more general would be useful, i.e. a wrapper which evaluates only conditionally would give the cancel-ability and also be useful for other purposes.
>
> Fdef could be used for this already I suppose.
>
> S.
>
> On 29 Dec 2012, at 15:11, Jonatan Liljedahl wrote:
>
>> SkipJack has a few differences:
>> - the name of the class has nothing to do with "timer"
>> - survives cmdPeriod (as you said)
>> - most importantly, it always repeats, no one-shot timers
>>
>> Also it's rather complex compared to a simple lightweight timer, due
>> to the cmdperiod-survival and storing skipjacks by name, etc. I think
>> SkipJack has a clear and useful purpose (periodic timer that survives
>> cmdPeriod), and that it would be nice with a separate simple and clear
>> timer class similar or equal to the one I posted, instead of extending
>> SkipJack.
>>
>> On Sat, Dec 29, 2012 at 9:31 PM, Jakob Leben <jakob.leben@xxxxxxxxx> wrote:
>>> On Sat, Dec 29, 2012 at 4:54 PM, Jonatan Liljedahl <lijon@xxxxxxxxxxxx> wrote:
>>>> sclang does not have Timers, in the usual sense of timers in other
>>>> languages, like NSTimer in obj-c.
>>>>
>>>> There is someClock.sched, but those are not cancelable.
>>>
>>> Well, there is SkipJack. It survives CmdPeriod, but could easily be
>>> extended to not...
>>>
>>> _______________________________________________
>>> sc-dev mailing list
>>>
>>> info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
>>> archive: https://listarc.bham.ac.uk/marchives/sc-dev/
>>> search: https://listarc.bham.ac.uk/lists/sc-dev/search/
>>
>>
>>
>> --
>> /Jonatan
>> http://kymatica.com
>>
>> _______________________________________________
>> sc-dev mailing list
>>
>> info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
>> archive: https://listarc.bham.ac.uk/marchives/sc-dev/
>> search: https://listarc.bham.ac.uk/lists/sc-dev/search/
>
>
> _______________________________________________
> sc-dev mailing list
>
> info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
> archive: https://listarc.bham.ac.uk/marchives/sc-dev/
> search: https://listarc.bham.ac.uk/lists/sc-dev/search/



--
/Jonatan
http://kymatica.com

_______________________________________________
sc-dev mailing list

info (subscription, etc.): http://www.beast.bham.ac.uk/research/sc_mailing_lists.shtml
archive: https://listarc.bham.ac.uk/marchives/sc-dev/
search: https://listarc.bham.ac.uk/lists/sc-dev/search/


--
..
http://soundcloud.com/crucialfelix
http://github.com/crucialfelix
.