{"id":17049814,"url":"https://github.com/marzer/spin_mutex","last_synced_at":"2025-03-23T04:27:49.348Z","repository":{"id":173375500,"uuid":"650668667","full_name":"marzer/spin_mutex","owner":"marzer","description":"A C++11 mutex class implemented using atomic spin-waiting.","archived":false,"fork":false,"pushed_at":"2023-06-14T16:44:51.000Z","size":18,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-01-28T11:18:24.275Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","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/marzer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":"marzer"}},"created_at":"2023-06-07T14:51:54.000Z","updated_at":"2024-02-10T07:53:25.000Z","dependencies_parsed_at":"2023-09-09T03:00:34.670Z","dependency_job_id":null,"html_url":"https://github.com/marzer/spin_mutex","commit_stats":null,"previous_names":["marzer/spin_mutex"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marzer%2Fspin_mutex","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marzer%2Fspin_mutex/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marzer%2Fspin_mutex/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/marzer%2Fspin_mutex/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/marzer","download_url":"https://codeload.github.com/marzer/spin_mutex/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245056421,"owners_count":20553853,"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-10-14T09:55:27.358Z","updated_at":"2025-03-23T04:27:49.317Z","avatar_url":"https://github.com/marzer.png","language":"C++","funding_links":["https://github.com/sponsors/marzer"],"categories":[],"sub_categories":[],"readme":"# `mz::spin_mutex` [![MIT license](docs/images/badge-license-MIT.svg)](./LICENSE) [![C++11](docs/images/badge-c++11.svg)][cpp_compilers] [![Sponsor](docs/images/badge-sponsor.svg)][sponsor] [![Gitter](docs/images/badge-gitter.svg)][gitter]\n\nA `std::mutex`-compatible mutex class implemented using atomic spin-waiting.\n\nBased on Erik Rigtorp's article [Correctly implementing a spinlock in C++] and incorporating some advice from\nthe [Intel 64 and IA-32 Architectures Optimization Reference Manual].\n\nRequires C++11.\n\n\u003cbr\u003e\n\n## Synopsis\n\n```cpp\nnamespace mz\n{\n    class spin_mutex\n    {\n        // acquires a lock on the mutex\n        void lock() noexcept;\n\n        // tries to acquire a lock on the mutex,\n        // returning true if the lock was successfully acquired\n        bool try_lock() noexcept;\n\n        // releases the lock currently held on the mutex\n        void unlock() noexcept;\n    };\n}\n```\n\n\u003cbr\u003e\n\n## Usage\n\nThe library is a single header so the easiest way to use it is to drop [spin_mutex.hpp] somewhere in your project.\n\nAlternatively you can add `include` to your include paths then `#include \u003cmz/spin_mutex.hpp\u003e`\n\nThere is also support for use as a `meson.build` subproject.\n\n\u003cbr\u003e\n\n## License\n\nMIT. See [LICENSE](LICENSE).\n\n\u003cbr\u003e\n\n## Contributing\n\nThere are three ways you can contribute:\n\n1. Reporting bug or making feature requests [here](https://github.com/marzer/spin_mutex/issues/new)\n2. Opening a pull request (⚠\u0026#xFE0F; _caveat - see below_)\n3. Becoming a [sponsor] ❤\u0026#xFE0F;\n\n### Pull requests\n\n`spin_mutex.hpp` is programmatically extracted from a much larger project so I won't accept pull requests made for this\nrepository directly; if you wish to contribute a bugfix or a feature, please find the `spin_mutex` implementation\n[in this project](https://github.com/marzer/muu) and propose your changes there instead.\nI will then propagate them to this satellite library when they are merged.\n\n[spin_mutex.hpp]: include/mz/spin_mutex.hpp\n[license]: ./LICENSE\n[cpp_compilers]: https://en.cppreference.com/w/cpp/compiler_support\n[gitter]: https://gitter.im/marzer/community\n[sponsor]: https://github.com/sponsors/marzer\n[Correctly implementing a spinlock in C++]: https://rigtorp.se/spinlock/\n[Intel 64 and IA-32 Architectures Optimization Reference Manual]: https://software.intel.com/sites/default/files/managed/9e/bc/64-ia-32-architectures-optimization-manual.pdf\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarzer%2Fspin_mutex","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmarzer%2Fspin_mutex","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmarzer%2Fspin_mutex/lists"}