Skip to content

Commit

Permalink
added lock-write to co-ordinate package sequence #56
Browse files Browse the repository at this point in the history
  • Loading branch information
mikespook committed Jan 15, 2015
1 parent c01a2e2 commit 9dbb3ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions worker/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -200,3 +200,10 @@ func (a *agent) write(outpack *outPack) (err error) {
}
return a.rw.Flush()
}

// Write with lock
func (a *agent) Write(outpack *outPack) (err error) {
a.Lock()
defer a.Unlock()
return a.write(outpack)
}
2 changes: 1 addition & 1 deletion worker/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ func (worker *Worker) exec(inpack *inPack) (err error) {
}
outpack.handle = inpack.handle
outpack.data = r.data
inpack.a.write(outpack)
inpack.a.Write(outpack)
}
return
}
Expand Down

0 comments on commit 9dbb3ea

Please sign in to comment.