💾 Archived View for station.martinrue.com › clseibold › cf90a6c305cf401d8a6b9787a8d1d5c3 captured on 2024-02-05 at 11:35:59. Gemini links have been rewritten to link to archived content
⬅️ Previous capture (2023-12-28)
-=-=-=-=-=-=-
First time using semaphores in golang! They are really useful for limiting the number of concurrent connections being handled by a server. They are also really easy to understand - acquire 1 from the semaphore (locking if 1 is not available), and then release it when the connection is finished. Other people use channels, but channels are over-complicated for something as simple as this, imo.
For anyone wondering, I'm using this package: golang.org/x/sync/semaphore
2 months ago