Skip to content

Commit

Permalink
fix lock
Browse files Browse the repository at this point in the history
  • Loading branch information
pocke committed Jan 17, 2015
1 parent 51c1549 commit fbefc5e
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions goevent.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ func New() Event {
var _ Event = New()

func (p *event) Trigger(args ...interface{}) error {
p.lmu.Lock()
defer p.lmu.Unlock()

arguments := make([]reflect.Value, 0, len(args))
argTypes := make([]reflect.Type, 0, len(args))
Expand All @@ -74,6 +72,9 @@ func (p *event) Trigger(args ...interface{}) error {
return err
}

p.lmu.RLock()
defer p.lmu.RUnlock()

wg := sync.WaitGroup{}
wg.Add(len(p.listeners))
for _, fn := range p.listeners {
Expand Down

0 comments on commit fbefc5e

Please sign in to comment.