events.Subscription.Poll does not seem to require locking

This is a large source of output from the new lock logging, and it
doesn't seem to accomplish anything useful that I can see. Running
integration with the race detector to make sure...
This commit is contained in:
Jakob Borg 2015-04-24 09:38:34 +09:00
parent e158f17c2b
commit 7bf55dd14f

View File

@ -103,7 +103,6 @@ type Subscription struct {
mask EventType mask EventType
id int id int
events chan Event events chan Event
mutex sync.Mutex
} }
var Default = NewLogger() var Default = NewLogger()
@ -153,7 +152,6 @@ func (l *Logger) Subscribe(mask EventType) *Subscription {
mask: mask, mask: mask,
id: l.nextID, id: l.nextID,
events: make(chan Event, BufferSize), events: make(chan Event, BufferSize),
mutex: sync.NewMutex(),
} }
l.nextID++ l.nextID++
l.subs[s.id] = s l.subs[s.id] = s
@ -172,9 +170,6 @@ func (l *Logger) Unsubscribe(s *Subscription) {
} }
func (s *Subscription) Poll(timeout time.Duration) (Event, error) { func (s *Subscription) Poll(timeout time.Duration) (Event, error) {
s.mutex.Lock()
defer s.mutex.Unlock()
if debug { if debug {
dl.Debugln("poll", timeout) dl.Debugln("poll", timeout)
} }