forked from yuxh/gearman-go
added lock-write to co-ordinate package sequence #56
This commit is contained in:
parent
c01a2e22c0
commit
9dbb3ea3fc
@ -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)
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user