equal
deleted
inserted
replaced
30 |
30 |
31 |
31 |
32 /* event invocation */ |
32 /* event invocation */ |
33 |
33 |
34 def event(x: Event) { synchronized { receivers.foreach(_ ! x) } } |
34 def event(x: Event) { synchronized { receivers.foreach(_ ! x) } } |
|
35 |
|
36 |
|
37 /* await global condition -- triggered via bus events */ |
|
38 |
|
39 def await(cond: => Boolean) |
|
40 { |
|
41 case object Wait |
|
42 val a = new Actor { |
|
43 def act { |
|
44 if (cond) react { case Wait => reply(()); exit(Wait) } |
|
45 else { |
|
46 loop { |
|
47 react { |
|
48 case trigger if trigger != Wait => |
|
49 if (cond) { react { case Wait => reply(()); exit(Wait) } } |
|
50 } |
|
51 } |
|
52 } |
|
53 } |
|
54 } |
|
55 this += a |
|
56 a.start |
|
57 a !? Wait |
|
58 this -= a |
|
59 } |
35 } |
60 } |