Hello,
Semaphores are often used to bound concurrency, for example I was implementing a goroutines pool pattern with weighted jobs, so a weighted semaphore is better and more performant than channel-based semaphore. a common functionality in goroutines pool is to be resizable, however the current sync/x/semaphore doesn't allow resizing the semaphore.
There is another implementation of a non-channel-based semaphores that supports resizing, but I found many bugs/deadlocks using them and they're all less performant than x/sync/semaphore.
The current implementation of x/sync/semaphore can be easily extended to be resizable, without affecting performance by any means.
Hello,
Semaphores are often used to bound concurrency, for example I was implementing a goroutines pool pattern with weighted jobs, so a weighted semaphore is better and more performant than channel-based semaphore. a common functionality in goroutines pool is to be resizable, however the current
sync/x/semaphoredoesn't allow resizing the semaphore.There is another implementation of a non-channel-based semaphores that supports resizing, but I found many bugs/deadlocks using them and they're all less performant than
x/sync/semaphore.The current implementation of
x/sync/semaphorecan be easily extended to be resizable, without affecting performance by any means.