Permalink
Browse files

Don't think I need the locks

  • Loading branch information...
1 parent a13f1bc commit adcc1a3a29070e7937dafdae98d7c8e1b924676a @mrb committed Jan 6, 2013
Showing with 4 additions and 12 deletions.
  1. +4 −2 examples/syncasync/main.go
  2. +0 −10 node.go
@@ -49,8 +49,10 @@ func main() {
}
func Starter(c syl.Channels, g syl.ControlChan) {
- for cd := 0; cd < 100; cd++ {
- c.Data <- []byte{byte(cd)}
+ for { //
+ for cd := 0; cd < 100; cd++ {
+ c.Data <- []byte{byte(cd)}
+ }
}
c.Control.Exit()
}
View
@@ -1,13 +1,5 @@
package sylvester
-import (
- "sync"
-)
-
-var (
- syncPositionMutex = &sync.Mutex{}
-)
-
type Event func(Channels, ControlChan)
type Node struct {
@@ -73,13 +65,11 @@ func (n *Node) StartSyncEvents() {
}
func (n *Node) NextSyncEvent() {
- syncPositionMutex.Lock()
sp := n.syncPosition
if sp == (len(n.syncEvents) - 1) {
n.syncPosition = 0
} else {
n.syncPosition++
}
go n.syncEvents[n.syncPosition](*n.Channels, n.graph.Control)
- syncPositionMutex.Unlock()
}

0 comments on commit adcc1a3

Please sign in to comment.