Skip to content
Browse files

Some explanation in syncasync

  • Loading branch information...
1 parent adcc1a3 commit 945ed87134122e3bc9774a06b3ad8305916a51a2 @mrb committed Jan 6, 2013
Showing with 12 additions and 1 deletion.
  1. +12 −1 examples/syncasync/main.go
View
13 examples/syncasync/main.go
@@ -1,3 +1,14 @@
+/*
+
+An example illustrating the use of async and sync events within the same node.
+The "Starter" event pushes bits into the data channel, and the async logger is
+a simple consume-and-log event. The sync events each consume a bit and log, and
+signal when they are done to trigger the next sync event. The results of this
+example will show that the async events are returned in the order dictated by
+the random amount of time they sleep, while the sync events always execute and
+print bits in a guaranteed order.
+
+*/
package main
import (
@@ -49,7 +60,7 @@ func main() {
}
func Starter(c syl.Channels, g syl.ControlChan) {
- for { //
+ for {
for cd := 0; cd < 100; cd++ {
c.Data <- []byte{byte(cd)}
}

0 comments on commit 945ed87

Please sign in to comment.
Something went wrong with that request. Please try again.