Fix lock contention

This commit is contained in:
kortschak 2014-08-04 12:32:43 +09:30
parent ffb52af00b
commit 6513685520
2 changed files with 3 additions and 3 deletions

View file

@ -141,8 +141,9 @@ func (s *Session) runUnsafe(input interface{}) (otto.Value, error) {
}
s.envLock.Lock()
defer s.envLock.Unlock()
return s.env.Run(input)
env := s.env
s.envLock.Unlock()
return env.Run(input)
}
func (s *Session) ExecInput(input string, out chan interface{}, limit int) {