{"id":21300347,"url":"https://github.com/silkcutks/c_thread_pool","last_synced_at":"2025-07-11T19:31:11.190Z","repository":{"id":186983068,"uuid":"113288768","full_name":"silkcutKs/c_thread_pool","owner":"silkcutKs","description":"thread pool with c language","archived":false,"fork":false,"pushed_at":"2017-12-06T09:08:15.000Z","size":3,"stargazers_count":4,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-08-08T14:41:45.764Z","etag":null,"topics":["c","pthreads","threadpool","workpool"],"latest_commit_sha":null,"homepage":null,"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/silkcutKs.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}},"created_at":"2017-12-06T08:22:22.000Z","updated_at":"2023-08-08T14:41:52.220Z","dependencies_parsed_at":"2023-08-08T14:54:36.486Z","dependency_job_id":null,"html_url":"https://github.com/silkcutKs/c_thread_pool","commit_stats":null,"previous_names":["silkcutks/c_thread_pool"],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silkcutKs%2Fc_thread_pool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silkcutKs%2Fc_thread_pool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silkcutKs%2Fc_thread_pool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/silkcutKs%2Fc_thread_pool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/silkcutKs","download_url":"https://codeload.github.com/silkcutKs/c_thread_pool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225750102,"owners_count":17518315,"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":["c","pthreads","threadpool","workpool"],"created_at":"2024-11-21T15:09:21.018Z","updated_at":"2024-11-21T15:09:21.756Z","avatar_url":"https://github.com/silkcutKs.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# c language thread pool\n\n## use\nbuild your executable file with `worker_pool.c -lpthread`\n\nfirst step, create worker pool with worker num, which will effect your concurrence.\n\n```c\nworker_pool *wp =  create_worker_pool(worker_num);\n```\n\nsecond, add task which you want to execute async.\n\n```c\nadd_task(wp, execute_func, data);  \n```\n\nfinally, destroy your worker_pool.\n\n```c\ndestroy_worker_pool(wp);\n```\n\nextra, monitor run status.\n\n```c\ndump_worker_pool_status(worker_pool *wp);\n```\n\n## test\n\n```shell\ngcc -std=gnu99 -o main test.c worker_pool.c -lpthread\n./main\n```\n\noutput:\n\n```shell\nstart worker 1\nstart worker 2\nend worker 2\nstart worker 1\nstart worker 2\nend worker 2\nstart worker 1\nstart worker 2\n```\n\n## advantage \n\nsome action use `pthread_barrier_*` functions to sync data without lock.\n\n## next\n- use lock free struct to release lock time wait.\n- destroy with wait.\n- execute more fast.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilkcutks%2Fc_thread_pool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsilkcutks%2Fc_thread_pool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsilkcutks%2Fc_thread_pool/lists"}