2008/4/28 Atte André Jensen
Ok, so to put in a language that I understand, are you saying I should replace my 1::samp => now with me.yield()?


Yes, I think so.

Advancing time, which is what you are doing, gives other shreds a chance to run but it also means this shred will only get the cpu back in a while.

The difference is likely academic but if OSC messages would be flooding in faster then you are advancing time the cue would pile up and latency (or worse) would follow.

The core concept here is that "samp => now" does two things;
a) hand the cpu to other shreds
b) make the next bit of code execute in a while (likely a 44K'th of a second here)

me.yield() only does the first of the two and not the second.

The issue is that while it may look like ChucK is aimed towards parallel-processing it's in fact very much focussed on making multiple processes take turns sequentially. What we are dealing with here is (amongst other issues) this exact sequence.

Hope that helps,
Kas.