mirror of
https://git.sr.ht/~rjarry/aerc
synced 2026-03-02 18:23:33 +01:00
worker: fix potential race in post action
Signed-off-by: Robin Jarry <robin@jarry.cc>
This commit is contained in:
@@ -106,14 +106,13 @@ func (worker *Worker) processQueue() {
|
||||
// from the same goroutine that the worker runs in or deadlocks may occur
|
||||
func (worker *Worker) PostAction(msg WorkerMessage, cb func(msg WorkerMessage)) {
|
||||
worker.setId(msg)
|
||||
// write to actions channel without blocking
|
||||
worker.queue(msg)
|
||||
|
||||
if cb != nil {
|
||||
worker.Lock()
|
||||
worker.actionCallbacks[msg.getId()] = cb
|
||||
worker.Unlock()
|
||||
}
|
||||
// write to actions channel without blocking
|
||||
worker.queue(msg)
|
||||
}
|
||||
|
||||
var WorkerMessages = make(chan WorkerMessage, 50)
|
||||
|
||||
Reference in New Issue
Block a user