{"id":18473961,"url":"https://github.com/sebouellette/pooler","last_synced_at":"2025-05-13T00:52:47.362Z","repository":{"id":259327722,"uuid":"877572622","full_name":"SebOuellette/pooler","owner":"SebOuellette","description":"A single-header threadpool library for Cpp11 and above","archived":false,"fork":false,"pushed_at":"2024-10-24T02:11:09.000Z","size":45,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-05-13T00:52:44.063Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SebOuellette.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-23T22:11:54.000Z","updated_at":"2024-10-24T02:06:59.000Z","dependencies_parsed_at":"2024-10-24T12:45:58.166Z","dependency_job_id":"ad533b65-572d-4171-899c-e420a407cb1b","html_url":"https://github.com/SebOuellette/pooler","commit_stats":null,"previous_names":["sebouellette/pooler"],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SebOuellette%2Fpooler","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SebOuellette%2Fpooler/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SebOuellette%2Fpooler/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SebOuellette%2Fpooler/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SebOuellette","download_url":"https://codeload.github.com/SebOuellette/pooler/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253850891,"owners_count":21973672,"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-11-06T10:27:36.317Z","updated_at":"2025-05-13T00:52:47.326Z","avatar_url":"https://github.com/SebOuellette.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pooler.h\nA tiny single-header thread-pool library for C++11 and above\n\n## Why Pooler?\nUsing Pooler is similar to using other thread-pool libraries such as boost. \nThe advantage of Pooler however, is that there is no need for the rest of boost or any other threading library. \nPooler is built using standard c++ conditional_lock objects, so any compiler capable of C++11 can already compile a project with Pooler.\n\u003cbr\u003e\u003cbr\u003e\nPooler is great for existing projects where the addition of a whole threading library will either be too complicated to implement practically, or would introduce a large amount of overhead to the codebase. \nThese frustrations were the driving forces behind the development of Pooler.\n## Pooler vs Boost\n\nNo metrics on efficiency or speed have been calculated so far. An example of the differences in implementation can be found below:\n#### Boost\nThis example was collected from [boost.org's thread_pool documentation.](https://www.boost.org/doc/libs/1_75_0/doc/html/boost_asio/reference/thread_pool.html)\n```cpp\nvoid my_task()\n{\n  ...\n}\n\n...\n\n// Launch the pool with four threads.\nboost::asio::thread_pool pool(4);\n\n// Submit a function to the pool.\nboost::asio::post(pool, my_task);\n\n// Submit a lambda object to the pool.\nboost::asio::post(pool,\n    []()\n    {\n      ...\n    });\n\n// Wait for all tasks in the pool to complete.\npool.join();\n```\n#### Pooler\nPooler allows passing input data to threads before the RUN signal is issued using an optional second argument to the run() member function.\n```cpp\n#include \"pooler.h\"\n\nPOOLER_FUNC(my_task, {   // equivalent to   void my_task(Pooler::threadid_t id, void* data) { ... }\n  ...\n})\n\n...\n\n// Create a pool object and launch 4 threads\nPooler pool(4);\n\n// Input data for the pool (optional)\nvoid* inputData = ...;\n\n// Signal to threads to perform a pooler func. Provide optional inputData to be shared by each thread\n// Block until all threads are finished\npool.run(my_task, inputData);\n\n// Signal to threads to perform a pooler lambda\npool.run(POOLER_LAMBDA{ // equivalent to  [](Pooler::threadid_t id, void* data)-\u003evoid { ... }\n  ...\n});\n\n// Stop all threads once run returns\npool.stop();\n```\n## Can I use pooler in my project?\nYes. There are no restrictions on how you use Pooler or what you use it for. Personal and enterprise use is permitted free of charge. \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebouellette%2Fpooler","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsebouellette%2Fpooler","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsebouellette%2Fpooler/lists"}