[chuck-users] now v.s. actual time

Tom Lieber lieber at princeton.edu
Thu Oct 9 23:15:40 EDT 2008


On Thu, Oct 9, 2008 at 10:49 PM, Stephen Sinclair <radarsat1 at gmail.com> wrote:
> On Thu, Oct 9, 2008 at 10:09 PM, Tom Lieber <lieber at princeton.edu> wrote:
>>> In other words, if a function takes 3 ms to complete, you could make
>>> sure not to interrupt other shreds by,
>>>
>>> while (...) {
>>>  longfunction();
>>>  realnow => now;
>>> }
>>>
>>> This would ensure that logical time advances during the computation,
>>> while not forcing you to guess the actual time that longfunction()
>>> takes to execute.
>>>
>>> Note that none of this means changing anything in the shreduler.
>>
>> That wouldn't help at all, though. ChucK has to execute longfunction()
>> to completion (holding up every other shred during that time) before
>> it gets to "realnow => now;".
>
> Sorry, I meant to imply that longfunction() is a short part of a
> longer, iterative computation.
> In other words, all meant to say is, "move time along in the middle of
> your long computation".

Okay, that makes more sense. Still... that only helps with
implementations of longfunction() that take much less than a sample on
average to complete. If it's about a sample, you may as well replace
it with 1::samp => now;. If it's more than a sample, it will cause
underruns anyway.

-- 
Tom Lieber
http://AllTom.com/


More information about the chuck-users mailing list