{"id":18523106,"url":"https://github.com/taymindis/lfqueue","last_synced_at":"2025-07-11T13:40:56.951Z","repository":{"id":132372013,"uuid":"146538115","full_name":"Taymindis/lfqueue","owner":"Taymindis","description":"lock-free FIFO queue by C native built it, easy built cross platform(no extra dependencies needed) , guarantee thread safety memory management ever!","archived":false,"fork":false,"pushed_at":"2020-11-05T18:33:50.000Z","size":39,"stargazers_count":143,"open_issues_count":4,"forks_count":23,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-03-24T05:13:09.312Z","etag":null,"topics":["atomic-operation","c","cpp","cross-platform","generic-types","lock-free","lock-free-queue","thread-safety","threadsafe","wait-free"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-2-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":"2018-08-29T03:10:43.000Z","updated_at":"2025-03-04T08:40:39.000Z","dependencies_parsed_at":null,"dependency_job_id":"935d138b-b1e0-4998-aaeb-f7fae4b8ad4f","html_url":"https://github.com/Taymindis/lfqueue","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taymindis%2Flfqueue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taymindis%2Flfqueue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taymindis%2Flfqueue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Taymindis%2Flfqueue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Taymindis","download_url":"https://codeload.github.com/Taymindis/lfqueue/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248031405,"owners_count":21036392,"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":["atomic-operation","c","cpp","cross-platform","generic-types","lock-free","lock-free-queue","thread-safety","threadsafe","wait-free"],"created_at":"2024-11-06T17:34:16.050Z","updated_at":"2025-04-09T11:31:27.262Z","avatar_url":"https://github.com/Taymindis.png","language":"C","readme":"# lfqueue [![Build Status](https://travis-ci.org/Taymindis/lfqueue.svg?branch=master)](https://travis-ci.org/Taymindis/lfqueue)\n\nlock-free FIFO queue by C native built it, easy built cross platform(no extra dependencies needed) , guarantee thread safety memory management ever!\n\n\n# All Platform tests\n\nGCC/CLANG | [![Build Status](https://travis-ci.org/Taymindis/lfqueue.svg?branch=master)](https://travis-ci.org/Taymindis/lfqueue)\n\nVS x64/x86 | [![Build status](https://ci.appveyor.com/api/projects/status/7srsrdgj7f524sam?svg=true)](https://ci.appveyor.com/project/Taymindis/lfqueue)\n\n\n## API \n```c\n\nextern int   lfqueue_init(lfqueue_t *lfqueue);\nextern int   lfqueue_enq(lfqueue_t *lfqueue, void *value);\nextern void* lfqueue_deq(lfqueue_t *lfqueue);\nextern void* lfqueue_single_deq(lfqueue_t *lfqueue);\nextern void lfqueue_destroy(lfqueue_t *lfqueue);\nextern size_t lfqueue_size(lfqueue_t *lfqueue);\nextern void lfqueue_sleep(unsigned int milisec);\n\n```\n\n\n## Example\n\n```c\n\nint* int_data;\nlfqueue_t my_queue;\n\nif (lfqueue_init(\u0026my_queue) == -1)\n\treturn -1;\n\n/** Wrap This scope in other threads **/\nint_data = (int*) malloc(sizeof(int));\nassert(int_data != NULL);\n*int_data = i++;\n/*Enqueue*/\n while (lfqueue_enq(\u0026my_queue, int_data) == -1) {\n    printf(\"ENQ Full ?\\n\");\n}\n\n/** Wrap This scope in other threads **/\n/*Dequeue*/\nwhile  ( (int_data = lfqueue_deq(\u0026my_queue)) == NULL) {\n    printf(\"DEQ EMPTY ..\\n\");\n}\n\n// printf(\"%d\\n\", *(int*) int_data );\nfree(int_data);\n/** End **/\n\nlfqueue_destroy(\u0026my_queue);\n\n```\n\n\n#### If you are using single thread dequeue/consume. Please use `lfqueue_single_deq` to get better result\n\n\n## Build and Installation\n\nFor linux OS, you may use cmake build, for other platforms, please kindly include the source code and header file into the project, e.g. VS2017, DEV-C++, Xcode\n\n```bash\nmkdir build\n\ncd build\n\ncmake ..\n\nmake\n\n./lfqueue-example\n\nvalgrind --tool=memcheck --leak-check=full ./lfqueue-example\n\nsudo make install\n\n\n```\n\n## continuously Test \n\nFor continuously test until N number, if you having any issue while testing, please kindly raise an issue\n\n```bash\n\n./keep-testing.sh\n\n```\n\n\n## Uninstallation\n\n```bash\ncd build\n\nsudo make uninstall\n\n```\n\n\n## You may also like lock free stack LIFO\n\n[lfstack](https://github.com/Taymindis/lfstack)","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaymindis%2Flfqueue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftaymindis%2Flfqueue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftaymindis%2Flfqueue/lists"}