repo.or.cz
/
chuck-blob.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
*** empty log message ***
[chuck-blob.git]
/
v2
/
test
/
53.ck
blob
f4c306ab715f5a8e03c3530eaec68163a5dbd43e
1
// 53.ck : one event broadcast
2
3
// the event
4
Event e;
5
6
// handler
7
fun int hi( Event e, string id )
8
{
9
while( true )
10
{
11
// wait on event
12
e => now;
13
<<<id>>>;
14
}
15
}
16
17
// spork
18
spork ~ hi( e, "yo" );
19
spork ~ hi( e, "hi" );
20
spork ~ hi( e, "hello" );
21
spork ~ hi( e, "hey come back here!" );
22
23
// infinite time loop
24
while( true )
25
{
26
// advance time
27
1::second => now;
28
// broadcast all waiting shreds
29
e.broadcast();
30
}