But the worker is still blocking on the channel. I'm not sure I understand the difference between blocking on a channel versus blocking on a condition variable.
In an effort of separating concerns that are coupled, the code introduces an implicit dependency between the counter in the semaphore and a secondary counter that can lead to a deadlock if there are any "math" errors. Instead of trying to catch this through comprehensive code review, it would be better to use a synchronization approach where there is a single counter (if possible).
Originally posted by @bernard-avalabs in #1685 (comment)