[chuck-users] Question on Shred Scheduling

Mike McGonagle mjmogo at gmail.com
Sat Jun 17 14:01:17 EDT 2006

Hello all,

I have read through the stuff on events (and it seems quite limited in
documentation and examples), and thought that there was no way that I
could use events to handle the scheduling of additional mask controls.
But, it kind of dawned on me, that MAYBE, if I put a call to
'me.yield()' at the top of the control shreds loop that it would delay
the execution of the body of the loop to the end of the time-slice.
So, now the 'helper' function would look like...

fun void helper(....) {
  true => keepGoing;
  while(keepGoing) {
     for(0 => int i; i < controllers.cap(); i++) {
        if (controllers[i] != null) {
           <<< "do something with this controller", "" >>>;
     now + control_period => now;

(control_period is assumed to be some arbitrary duration value)

Would this still be too much of an assumption that there wouldn't be
any data-collisions between shreds?

The reason that I am having a hard time with this, is that I can't
figure out how to send an event to another shred, without forcing the
receiving shred to "wait" on that event. The control shred needs to be
able to continue execution to handle the actual changing of the
parameters used by the masks.

Are there any examples of using events that do not require a shred to
'wait' on a scheduled event?



Help the Environment, Plant a Bush back in Texas!

"I place economy among the first and most important republican
virtues, and public debt as the greatest of the dangers to be feared.
To preserve our independence, we must not let our rulers load us with
perpetual debt."
-- Thomas Jefferson, third US president, architect and author (1743-1826)

More information about the chuck-users mailing list