{"id":31562830,"url":"https://github.com/pavanscales/usync","last_synced_at":"2025-10-05T04:53:05.630Z","repository":{"id":263464181,"uuid":"878310386","full_name":"pavanscales/usync","owner":"pavanscales","description":"efficient, word-sized synchronization primitives for Rust with advanced feature","archived":false,"fork":false,"pushed_at":"2024-10-25T09:07:28.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-15T12:46:08.567Z","etag":null,"topics":["fast","primitives","rust","synchornization","vimscript"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pavanscales.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":"2024-10-25T06:43:58.000Z","updated_at":"2024-12-01T13:12:13.000Z","dependencies_parsed_at":"2024-11-18T18:23:31.540Z","dependency_job_id":null,"html_url":"https://github.com/pavanscales/usync","commit_stats":null,"previous_names":["isafcck/usync","pawannnnn/usync","pawanjs/usync","manikupireddii/usync","pawanthegoat/usync","pawanchief/usync","pawanlifes/usync","pawanscales/usync","pavanscales/usync"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/pavanscales/usync","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavanscales%2Fusync","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavanscales%2Fusync/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavanscales%2Fusync/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavanscales%2Fusync/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pavanscales","download_url":"https://codeload.github.com/pavanscales/usync/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pavanscales%2Fusync/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":278411256,"owners_count":25982367,"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","status":"online","status_checked_at":"2025-10-05T02:00:06.059Z","response_time":54,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["fast","primitives","rust","synchornization","vimscript"],"created_at":"2025-10-05T04:53:04.857Z","updated_at":"2025-10-05T04:53:05.624Z","avatar_url":"https://github.com/pavanscales.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"usync\n============\n\n[![Crates.io](https://img.shields.io/crates/v/usync.svg)](https://crates.io/crates/usync)\n[![Documentation](https://docs.rs/usync/badge.svg)](https://docs.rs/usync/)\n[![MSRV: 1.59.0](https://flat.badgen.net/badge/MSRV/1.59.0/purple)](https://blog.rust-lang.org/2022/02/24/Rust-1.59.0.html)\n\nThis library provides implementations of `Mutex`, `RwLock`, `Condvar`, `Barrier` and\n`Once` that are word-sized and generally fast as those in [`parking_lot`](https://crates.io/crates/parking_lot).\nIt also provides a `ReentrantMutex` type which supports recursive locking. \n\n## Features\n\nThe primitives provided by this library have several advantages over those\nin the Rust standard library:\n\n1. All types require only 1 word of storage (unlike stdlib which stores\n   more state for poison detection).\n2. Inline uncontested paths and micro-contention handled with bounded,\n   adaptive spinning.\n3. `Condvar::notify_all` will generally only wake up a single thread and requeue the\n    rest to wait on the associated `Mutex`. This avoids a thundering herd\n    problem where all threads try to acquire the lock at the same time.\n4. `Mutex` and `RwLock` allow raw locking and unlocking without a RAII guard object.\n5. A `ReentrantMutex` type which supports recursive locking.\n6. Lock guards can be sent to other threads when the `send_guard` feature is\n    enabled.\n\n## Userspace queues\n\nTo keep these primitives word sized, their state is multiplexed between \ncounters, queues of threads, and combinations of both. This draws similarities\nto Windows' [Slim Synchronization Primitives](https://docs.microsoft.com/en-us/archive/msdn-magazine/2007/june/concurrency-synchronization-primitives-new-to-windows-vista). No external locking\nof global queues as seen in Linux futex or parking_lot is employed. The queues are all\nembedded in each primitive and interacted with lock-free operations to decrease worst-case contention latency.\n\nHaving to juggle around queues with the synchronization state unfortunately means\nthat \"no spurious wakeups\" cannot be guaranteed for `Condvar` and that extreme read-only workflows\nfor `RwLock` can't use optimized atomics to improve throughput. These perf limits shouldn't matter\nin practice though, even more so when other cache effects come into play. On the bright side, \nwriter/exclusive heavy workloads scale much better than existing solutions and are heavily\noptimized for micro-contention.\n\n## Nightly vs stable\n\nThere are a few restrictions when using this library on stable Rust:\n\n- You will have to use the `const_*` functions (e.g. `const_mutex(val)`) to\n  statically initialize the locking primitives. Using e.g. `Mutex::new(val)`\n  does not work on stable Rust yet.\n\nTo enable nightly-only functionality, you need to enable the `nightly` feature\nin Cargo (see below).\n\n## Usage\n\nAdd this to your `Cargo.toml`:\n\n```toml\n[dependencies]\nusync = \"0.2.1\"\n```\n\nTo enable nightly-only features, add this to your `Cargo.toml` instead:\n\n```toml\n[dependencies]\nusync = { version = \"0.2.1\", features = [\"nightly\"] }\n```\n\nTo allow sending `MutexGuard`s and `RwLock*Guard`s to other threads, enable the\n`send_guard` option.\n\n## License\n\nLicensed under MIT license ([LICENSE-MIT](LICENSE-MIT) or http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpavanscales%2Fusync","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpavanscales%2Fusync","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpavanscales%2Fusync/lists"}