{"id":20512641,"url":"https://github.com/db7/barrier","last_synced_at":"2025-07-15T10:07:32.306Z","repository":{"id":144211334,"uuid":"71776053","full_name":"db7/barrier","owner":"db7","description":"A barrier to synchronize a group of goroutines with an optional callback executed in isolation.","archived":false,"fork":false,"pushed_at":"2016-10-25T08:17:03.000Z","size":7,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-05T22:47:41.315Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/db7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-10-24T10:01:40.000Z","updated_at":"2019-05-26T18:20:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"79186fb1-5246-460e-a6a9-0042ffec2883","html_url":"https://github.com/db7/barrier","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/db7/barrier","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fbarrier","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fbarrier/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fbarrier/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fbarrier/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/db7","download_url":"https://codeload.github.com/db7/barrier/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/db7%2Fbarrier/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265427402,"owners_count":23763311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T20:42:13.393Z","updated_at":"2025-07-15T10:07:32.261Z","avatar_url":"https://github.com/db7.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# barrier\n\n[![GoDoc](https://godoc.org/github.com/db7/barrier?status.png)](https://godoc.org/github.com/db7/barrier)\n\nBarrier is a data structure to synchronize a fixed-size group of goroutines,\nblocking them until all arrive on the barrier, by calling `Await()`.\nOnce the last goroutine arrives, an optional callback is executed in isolation.\nThe barrier can be immediately reused after the goroutines return from\n`Await()`.\n\nThis barrier implementation supports early termination by calling `Abort()`.\nOnce aborted the barrier cannot be reused. Also, if the barrier detects that\n`Await()` is concurrently called by often than the number specified in the\nconstructor, the barrier is aborted.\n\n### Algorithm\n\nThe algorithm is pretty similar to the simple algorithm described in\n*The Art of Multiprocessor Programming - Herlihy and Shavit*.\nBy using a mutex and creating a new channel on every reset, however,\none does not have to implement a goroutine-bound sense variable.\n\n### Alternatives\n\nA simpler version, also using channels and a mutex, can be found\n[here](http://www.gofragments.net/client/blog/concurrency/2015/11/09/cyclicBarrierMutexChan/index.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdb7%2Fbarrier","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdb7%2Fbarrier","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdb7%2Fbarrier/lists"}