I'm trying to communicate between shreds. The docs say static data
isn't completely implemented so I realize this may not be possible
right now. If it is possible, I wondering if someone could let me
know if I'm taking the correct approach here and how I might achieve
this goal.
I run the command "chuck TheEvent.ck events.ck" and get this result:
[chuck](VM): sporking incoming shred: 3 (events2.ck)...
[chuck](VM): sporking incoming shred: 4 (events2.ck)...
[chuck](VM): sporking incoming shred: 5 (events2.ck)...
[chuck](VM): sporking incoming shred: 6 (events2.ck)...
"signaling" : (string)
"signaling" : (string)
"signaling" : (string)
"signaling" : (string)
...
It keeps signaling but the data is never printed. The three files
used are given below.
Thanks for any help,
Ollie
========================= TheEvent.ck =========================
public class TheEvent extends Event
{
static int value;
}
========================= events.ck =========================
// the event
TheEvent e;
machine.add( "events2.ck" );
machine.add( "events2.ck" );
machine.add( "events2.ck" );
machine.add( "events2.ck" );
// infinite time loop
while( true )
{
// advance time
1::second => now;
// set data
math.rand2( 0, 5 ) => e.value;
// signal one waiting shred
e.signal();
<<<"signaling">>>;
}
========================= events2.ck =========================
// the event
TheEvent e;
// loop
while( true )
{
// wait on event
e => now;
// get the data
<<