diff options
author | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-11 16:06:50 +0200 |
---|---|---|
committer | Robin Haberkorn <robin.haberkorn@googlemail.com> | 2012-09-11 16:06:50 +0200 |
commit | 0a5cb89744cbd737b73e2687fd546952caae0661 (patch) | |
tree | cf18580b86eb9cf81ba272e50ed34af9cf713486 /lib | |
parent | a52a1d65a95606c254e384b558de49371002252c (diff) | |
download | digitale-debutanten-0a5cb89744cbd737b73e2687fd546952caae0661.tar.gz |
explicitly yield() after broadcast() since it does not automatically yield (only when the broadcasting shred waits itself but this can be several messages later)
fixes message loss for NanoEvents and RumbleEvents
Diffstat (limited to 'lib')
-rw-r--r-- | lib/NanoEvent.ck | 9 | ||||
-rw-r--r-- | lib/RumbleEvent.ck | 6 |
2 files changed, 14 insertions, 1 deletions
diff --git a/lib/NanoEvent.ck b/lib/NanoEvent.ck index 2bf6378..9c501aa 100644 --- a/lib/NanoEvent.ck +++ b/lib/NanoEvent.ck @@ -64,8 +64,15 @@ public class NanoEvent extends GenEvent { msg.data3/127.0 => value; if (cmd == 0xB0 && - (wantScene == "" || scene == wantScene)) + (wantScene == "" || scene == wantScene)) { broadcast(); + /* + * ensure that shreds waiting on the event + * process it before it is overwritten + * by the next message in the queue + */ + me.yield(); + } } } /* not reached */ diff --git a/lib/RumbleEvent.ck b/lib/RumbleEvent.ck index 91aed80..d96635e 100644 --- a/lib/RumbleEvent.ck +++ b/lib/RumbleEvent.ck @@ -42,6 +42,12 @@ public class RumbleEvent extends GenEvent { <= IO.newline(); } else { broadcast(); + /* + * ensure that shreds waiting on the event + * process it before it is overwritten + * by the next message in the queue + */ + me.yield(); } } } |