Golang: How to timeout a semaphore?
问题 Semaphore in Golang is implemented with a channel: An example is this: https://sites.google.com/site/gopatterns/concurrency/semaphores Context: We have a few hundred servers and there are shared resources that we want to limit access to. So for a given resource, we want to use a semaphore to limit access to only 5 concurrent access by those servers. In order to do that, we are planning to use a lock server. When a machine accesses the resource, it will first register with the lock server that