{"id":16834604,"url":"https://github.com/gobwas/xsync","last_synced_at":"2025-04-11T04:35:16.292Z","repository":{"id":141233549,"uuid":"259066958","full_name":"gobwas/xsync","owner":"gobwas","description":"Priortizable and cancellable synchronization primitives in Go.","archived":false,"fork":false,"pushed_at":"2020-08-10T10:19:02.000Z","size":27,"stargazers_count":13,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T04:35:12.644Z","etag":null,"topics":["go"],"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/gobwas.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":"2020-04-26T15:36:14.000Z","updated_at":"2025-01-02T10:09:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"92fdbc99-0923-4b4c-b10f-986e1271ff71","html_url":"https://github.com/gobwas/xsync","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobwas%2Fxsync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobwas%2Fxsync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobwas%2Fxsync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/gobwas%2Fxsync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/gobwas","download_url":"https://codeload.github.com/gobwas/xsync/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345258,"owners_count":21088231,"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":["go"],"created_at":"2024-10-13T12:07:06.547Z","updated_at":"2025-04-11T04:35:16.260Z","avatar_url":"https://github.com/gobwas.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# xsync\n\n[![GoDoc][godoc-image]][godoc-url]\n[![Travis][travis-image]][travis-url]\n\n\u003e Priortizable and cancellable synchronization primitives in Go.\n\n# Usage\n\n## xsync.WorkerGroup\n\n```go\npackage main\n\nimport (\n\t\"sync\"\n\n\t\"github.com/gobwas/xsync\"\n)\n\nfunc main() {\n\tvar wg xsync.WorkerGroup\n\twg.Exec(\n\t\txsync.Demand{\n\t\t\tPriority: xsync.BytePriority(42),\n\t\t},\n\t\txsync.TaskFunc(func(ctx *xsync.WorkerContext) {\n\n\t\t}),\n\t})\n\twg.Close()\n}\n```\n\n## xsync.Cond\n\n```go\npackage main\n\nimport (\n\t\"sync\"\n\n\t\"github.com/gobwas/xsync\"\n)\n\nfunc main() {\n\tvar mu sync.Mutex\n\tcond := xsync.Cond{\n\t\tL: \u0026mu,\n\t}\n\tmu.Lock()\n\tfor !condition {\n\t\tcond.Wait(xsync.Demand{\n\t\t\tPriority: xsync.BytePriority(42),\n\t\t})\n\t}\n\t// action on condition.\n\tmu.Unlock()\n}\n```\n\n## examples\n\nFor more examples please take a look into _examples_ folder.\n\n# Why?\n\nThe idea of this package appeared year ago or something when I was playing with\nhigh-performant concurrent programming. The main intention of the package is to\nprovide an ability to select which kind of task should be performed when\nexecution resources are limited.\n\n# Status\n\nThis package is one of those projects that might be developed but then not then\nreleased anywhen. Fortunately I found time and motivation to complete it and\nshare with the community.\n\nCurrent API is not fixed, thus there is no `v1.0.0` tag yet. My main concerns\nare related to the `Demand` interface which I don't like much. Maybe I will\nchange it over time.\n\n# Performance\n\nGoroutine blocking mechanics are built over channels. Thus, it can't be more\nefficient than standard libarary's `sync` package. There are few benchmarks in\ntests, so feel free to run them.\n\n[godoc-image]:  https://godoc.org/github.com/gobwas/xsync?status.svg\n[godoc-url]:    https://godoc.org/github.com/gobwas/xsync\n[travis-image]: https://travis-ci.org/gobwas/xsync.svg?branch=master\n[travis-url]:   https://travis-ci.org/gobwas/xsync\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgobwas%2Fxsync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgobwas%2Fxsync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgobwas%2Fxsync/lists"}