{"id":19020702,"url":"https://github.com/bhhbazinga/lockfreequeue","last_synced_at":"2025-07-08T10:04:15.016Z","repository":{"id":158612891,"uuid":"222273430","full_name":"bhhbazinga/LockFreeQueue","owner":"bhhbazinga","description":"Lock Free Queue Based On Hazard Pointer.","archived":false,"fork":false,"pushed_at":"2020-02-27T03:30:16.000Z","size":67,"stargazers_count":37,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-17T22:09:01.358Z","etag":null,"topics":["cplusplus","hazard-pointers","lockfreequeue","threads"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bhhbazinga.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2019-11-17T15:58:47.000Z","updated_at":"2024-12-24T13:25:36.000Z","dependencies_parsed_at":null,"dependency_job_id":"9a8f8c66-f8f8-475f-99a0-e490bbd7713a","html_url":"https://github.com/bhhbazinga/LockFreeQueue","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/bhhbazinga%2FLockFreeQueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhhbazinga%2FLockFreeQueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhhbazinga%2FLockFreeQueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bhhbazinga%2FLockFreeQueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bhhbazinga","download_url":"https://codeload.github.com/bhhbazinga/LockFreeQueue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250386749,"owners_count":21422028,"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":["cplusplus","hazard-pointers","lockfreequeue","threads"],"created_at":"2024-11-08T20:18:15.196Z","updated_at":"2025-04-23T07:03:31.386Z","avatar_url":"https://github.com/bhhbazinga.png","language":"C++","readme":"# LockFreeQueue\nLock Free Queue Based On Hazard Pointer.\n## Feature\n  * Thread-safe and Lock-free. \n  * Hazard pointer.\n  * ABA safe.\n  * Inter thread helping.\n  * Singly-linked list with a sentinel node.\n  * Support Multi-producer \u0026 Multi-consumer.\n  * Dynamic size.  \n  * Dynamically allocate nodes(performance bottlneck). Or you can simply implement a thread-safe memory pool, e.g. by thread_local   storage identifier.\n## Benchmark\n\n  Magnitude     | Enqueue     | Dequeue     | Enqueue \u0026 Dequeue|\n  :-----------  | :-----------| :-----------| :-----------------\n  10K           | 1.8ms       | 1.4ms       | 2.6ms\n  100K          | 33.6ms      | 32.3ms      | 38.6ms\n  1000K         | 209.2ms     | 185.1ms     | 299.3ms\n  \nThe above data was tested on my i5-7500 cpu with gcc -O3.\\\nYou can also compare the tested data with [BlockingQueue](https://github.com/bhhbazinga/BlockingQueue) which is implemented by mutex.\n\nThe data of first and second column was obtained by starting 4 threads to enqueue concurrently and dequeue concurrently, the data of third column was obtained by starting 2 threads to enqueue and 2 threads to dequeue concurrently, each looped 10 times to calculate the average time consumption.\nSee also [test](test.cc).\n## Build\n```\nmake \u0026\u0026 ./test\n```\n## API\n```C++\nvoid Enqueue(const T\u0026 data);\nvoid Enqueue(T\u0026\u0026 data);\nvoid Emplace(Args\u0026\u0026... args);\nbool Dequeue(T\u0026 data);\nsize_t size() const;\n```\n## Reference\n[Lock-Free Data Structures with Hazard Pointers](https://www.drdobbs.com/lock-free-data-structures-with-hazard-po/184401890)\\\n[C++ Concurrency in Action, Second Edition](https://chenxiaowei.gitbook.io/c-concurrency-in-action-second-edition-2019/)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhhbazinga%2Flockfreequeue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbhhbazinga%2Flockfreequeue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbhhbazinga%2Flockfreequeue/lists"}