diff --git a/examples/syncasync/main.go b/examples/syncasync/main.go index 9402c8b..44a3e6e 100644 --- a/examples/syncasync/main.go +++ b/examples/syncasync/main.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() } diff --git a/node.go b/node.go index 692eaf3..c460321 100644 --- a/node.go +++ b/node.go @@ -1,13 +1,5 @@ package sylvester -import ( - "sync" -) - -var ( - syncPositionMutex = &sync.Mutex{} -) - type Event func(Channels, ControlChan) type Node struct { @@ -73,7 +65,6 @@ func (n *Node) StartSyncEvents() { } func (n *Node) NextSyncEvent() { - syncPositionMutex.Lock() sp := n.syncPosition if sp == (len(n.syncEvents) - 1) { n.syncPosition = 0 @@ -81,5 +72,4 @@ func (n *Node) NextSyncEvent() { n.syncPosition++ } go n.syncEvents[n.syncPosition](*n.Channels, n.graph.Control) - syncPositionMutex.Unlock() }