zencoder/recurrent — comment on commit 4375724520bc3295d912e27a5379f43e15d5b01e
File: lib/recurrent/scheduler.rb line 10
By nate:

There is a benefit to making your locking as fine-grained as possible. Only one synchronize block for a given mutex can be executing simultaneously. This means that if any other thread tries to call synchronize with the same mutex, it will have to wait until the first synchronize block is done executing. In recurrent, a counter increment/decrement might wait on anything that manipulates tasks, or vice versa, since they share a mutex. Using the finest-grained mutexes that you are able to will reduce this sort of contention and keep things flowing as smoothly as possible. Given the nature of the tasks you're using the mutex for, I doubt it will cause any serious contention as is, but who knows in the future.