{"id":18523111,"url":"https://github.com/taymindis/wfqueue","last_synced_at":"2025-10-16T12:19:31.936Z","repository":{"id":132372026,"uuid":"190961307","full_name":"Taymindis/wfqueue","owner":"Taymindis","description":"wait free FIFO queue, easy built cross platform(no extra dependencies needed)","archived":false,"fork":false,"pushed_at":"2019-07-05T23:26:04.000Z","size":86,"stargazers_count":85,"open_issues_count":1,"forks_count":10,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-10T03:55:56.077Z","etag":null,"topics":["async","c","cpp","header-only","lock-free","mpmc-queues","mpsc-queue","wait-free","wait-free-queue"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Taymindis.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":"2019-06-09T03:49:40.000Z","updated_at":"2024-01-04T16:34:41.000Z","dependencies_parsed_at":null,"dependency_job_id":"cf6c3d14-8bb8-495e-b304-e1c2e2aa52ea","html_url":"https://github.com/Taymindis/wfqueue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Taymindis/wfqueue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taymindis%2Fwfqueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taymindis%2Fwfqueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taymindis%2Fwfqueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taymindis%2Fwfqueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Taymindis","download_url":"https://codeload.github.com/Taymindis/wfqueue/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taymindis%2Fwfqueue/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279190601,"owners_count":26122938,"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-16T02:00:06.019Z","response_time":53,"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":["async","c","cpp","header-only","lock-free","mpmc-queues","mpsc-queue","wait-free","wait-free-queue"],"created_at":"2024-11-06T17:34:16.968Z","updated_at":"2025-10-16T12:19:31.903Z","avatar_url":"https://github.com/Taymindis.png","language":"C++","readme":"\u003cp align=\"left\"\u003e\u003cimg src=\"wfqueue_logo.png\" alt=\"wfqueue logo\" /\u003e\u003c/p\u003e\n\n# wfqueue.h [![Build Status](https://travis-ci.org/Taymindis/wfqueue.svg?branch=master)](https://travis-ci.org/Taymindis/wfqueue)\n\nc/c++ FIFO wait-free queue, easy built cross platform(no extra dependencies needed) \n\nGuarantee thread safety memory management, and it's all in one header only, as fast as never wait.\n\n\n# All Platform tests\n\nGCC/CLANG/G++/CLANG++ | [![Build Status](https://travis-ci.org/Taymindis/wfqueue.svg?branch=master)](https://travis-ci.org/Taymindis/wfqueue)\n\nVS x64/x86 | [![Build status](https://ci.appveyor.com/api/projects/status/k8rwm0cyfd4tq481?svg=true)](https://ci.appveyor.com/project/Taymindis/wfqueue)\n\n#### support MPMC, MPSC and MCSP\n\n## Example\n\n### if c++\n\n```c++\n\n#include \"wfqueue.h\"\n\n\ntWaitFree::Queue\u003cMyVal\u003e myqueue(sz);\n\n// wrap in to thread\nnew ClassVal s(...);\ntWaitFree::WfqEnqCtx\u003cMyVal\u003e enqCtx; // init 1 time in a thread only\ntWaitFree::WfqDeqCtx\u003cMyVal\u003e deqCtx; // init 1 time in a thread only\n\n\n// wrap in to thread\n// please use enq to guarantee enqueue.\nif(myqueue.tryEnq(s, enqCtx)) {\n\tprintf(\"%s\\n\", \"Enq Done\");\n} else {\n\tprintf(\"%s\\n\", \"queue is full, please try again to re-enqueue \");\n}\n\n// wrap in to thread\n// please use deq to guarantee dequeue.\nif(myqueue.tryDeq(s, deqCtx) {\n  s-\u003edo_op();\n}\n\n\n```\n\n### if c\n\n```c\n\n#include \"wfqueue.h\"\n\n// Fixed size of queue\nwfqueue_t *q = wfq_create(sz); \nwfq_enq_ctx_t enq_ctx = wfq_init_enq_ctx(); // init 1 time in a thread only\nwfq_deq_ctx_t deq_ctx = wfq_init_deq_ctx(); // init 1 time in a thread only\n// wrap in to thread\nClassVal *s = malloc(sizeof(ClassVal);\n\n// wfq_enq_must for guarantee enqueue\nwfq_enq_must(q, s, \u0026enq_ctx);\n\n// wrap in to thread\n// wfq_deq_must for guarantee dequeue\ns = (ClassVal*)wfq_deq(q, \u0026deq_ctx); // return NULL if no val consuming\n\nif(s) {\n  s-\u003edo_op();\n\n  free(s);\n}\n\nwfq_destroy(q);\n\n```\n\n## Build\n\ninclude header file in your project\n\n\n## Comparison with MoodyCamel/ConcurrentQueue\n\n#### 4 Concurrent Threads\n| Type \t| WFQUEUE (c++) ms\t| WFQUEUE (c)ms\t| MOODYCAMEL (ms) \t| INPUTS PER THREAD \t|\n|------\t|---------------\t|-------------\t|-----------------\t|------------------\t\t|\n| MPMC \t| 389.0         \t| 370         \t| 393.9           \t| 1,000,000 * 4    \t\t|\n| MPSC \t| 494.50        \t| 600         \t| 684.0           \t| 1,000,000 * 4    \t\t|\n| MCSP \t| 252.70        \t| 290.5       \t| 175.7           \t| 1,000,000 * 4    \t\t|\n\n\n#### 8 Concurrent Threads\n\n| Type \t| WFQUEUE (c++) ms\t| WFQUEUE (c)ms\t| MOODYCAMEL (ms) \t| INPUTS PER THREAD \t|\n|------\t|---------------\t|-------------\t|-----------------\t|------------------\t\t|\n| MPMC \t| 657.20        \t| 642.2        \t| 517.90           \t| 1,000,000 * 8    \t\t|\n| MPSC \t| 1140.50        \t| 1420         \t| 1471.8           \t| 1,000,000 * 8    \t\t|\n| MCSP \t| 247.80        \t| 245.2       \t| 253.2           \t| 1,000,000 * 8    \t\t|\n\n\n#### 8 Concurrent Threads with wfqueue(2 capacity only), create a small queue\n\n| Type \t| WFQUEUE (c++) ms\t| WFQUEUE (c)ms\t| MOODYCAMEL (ms) \t| INPUTS PER THREAD \t|\n|------\t|---------------\t|-------------\t|-----------------\t|------------------\t\t|\n| MPMC \t| 499\t        \t| 496        \t| 517.90           \t| 1,000,000 * 8    \t\t|\n| MPSC \t| 1718\t        \t| 1700         \t| 1471.8           \t| 1,000,000 * 8    \t\t|\n| MCSP \t| 403\t        \t| 360       \t| 253.2           \t| 1,000,000 * 8    \t\t|\n\n\n## Next feature target\n\nNo pre allocated size needed, it will expand itself (expandable size)\n\n## You may also like lock free queue FIFO\n\n[lfqueue](https://github.com/Taymindis/lfqueue)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaymindis%2Fwfqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaymindis%2Fwfqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaymindis%2Fwfqueue/lists"}