symonk/tasq

Feature: Insta-pause

symonk opened this issue · 1 comments

Right now, Stall() shovels tasks onto the Queues for the number of workers that will block on multiple select cases; There is a chance that in flight tasks would be attempted before the pause task hits each worker - Can we have the worker check some state immediately so tasks aren't required to be sent, but a mutex is unlocked?

The performance overhead of this is likely noticable, requires benchmarking etc

sync.RwMutex and have a writer lock on Stall() otherwise workers are considered 'readers' here might be possible