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

@ -255,7 +255,6 @@ func runIteratorOnSession(it graph.Iterator, ses *Session) {
it, _ = it.Optimize()
glog.V(2).Infoln(it.DebugString(0))
for {
// TODO(barakmich): Better halting.
select {
case <-ses.kill:
return

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) {