{"id":13438633,"url":"https://github.com/Maratyszcza/pthreadpool","last_synced_at":"2025-03-20T06:30:57.430Z","repository":{"id":36808990,"uuid":"41115850","full_name":"Maratyszcza/pthreadpool","owner":"Maratyszcza","description":"Portable (POSIX/Windows/Emscripten) thread pool for C/C++","archived":false,"fork":false,"pushed_at":"2024-06-16T19:49:19.000Z","size":212,"stargazers_count":365,"open_issues_count":12,"forks_count":143,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-13T13:10:11.634Z","etag":null,"topics":["multi-core","multi-threading","pthreads","threadpool"],"latest_commit_sha":null,"homepage":"","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/Maratyszcza.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":"2015-08-20T19:51:18.000Z","updated_at":"2025-02-22T10:45:36.000Z","dependencies_parsed_at":"2024-01-16T01:55:29.668Z","dependency_job_id":"2bafe869-3502-4c31-a087-5fb607e9ae83","html_url":"https://github.com/Maratyszcza/pthreadpool","commit_stats":{"total_commits":143,"total_committers":11,"mean_commits":13.0,"dds":0.5454545454545454,"last_synced_commit":"edeb5d6b967bef092ff195ab40e216fa5ac11f61"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maratyszcza%2Fpthreadpool","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maratyszcza%2Fpthreadpool/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maratyszcza%2Fpthreadpool/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Maratyszcza%2Fpthreadpool/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Maratyszcza","download_url":"https://codeload.github.com/Maratyszcza/pthreadpool/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244565095,"owners_count":20473205,"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":["multi-core","multi-threading","pthreads","threadpool"],"created_at":"2024-07-31T03:01:07.025Z","updated_at":"2025-03-20T06:30:52.420Z","avatar_url":"https://github.com/Maratyszcza.png","language":"C++","funding_links":[],"categories":["C++","\u003ca name=\"cpp\"\u003e\u003c/a\u003eC++"],"sub_categories":[],"readme":"# pthreadpool\n\n[![BSD (2 clause) License](https://img.shields.io/badge/License-BSD%202--Clause%20%22Simplified%22%20License-blue.svg)](https://github.com/Maratyszcza/pthreadpool/blob/master/LICENSE)\n[![Build Status](https://img.shields.io/travis/Maratyszcza/pthreadpool.svg)](https://travis-ci.org/Maratyszcza/pthreadpool)\n\n**pthreadpool** is a portable and efficient thread pool implementation.\nIt provides similar functionality to `#pragma omp parallel for`, but with additional features.\n\n## Features:\n\n* C interface (C++-compatible).\n* 1D-6D loops with step parameters.\n* Run on user-specified or auto-detected number of threads.\n* Work-stealing scheduling for efficient work balancing.\n* Wait-free synchronization of work items.\n* Compatible with Linux (including Android), macOS, iOS, Windows, Emscripten environments.\n* 100% unit tests coverage.\n* Throughput and latency microbenchmarks.\n\n## Example\n\n  The following example demonstates using the thread pool for parallel addition of two arrays:\n\n```c\nstatic void add_arrays(struct array_addition_context* context, size_t i) {\n  context-\u003esum[i] = context-\u003eaugend[i] + context-\u003eaddend[i];\n}\n\n#define ARRAY_SIZE 4\n\nint main() {\n  double augend[ARRAY_SIZE] = { 1.0, 2.0, 4.0, -5.0 };\n  double addend[ARRAY_SIZE] = { 0.25, -1.75, 0.0, 0.5 };\n  double sum[ARRAY_SIZE];\n\n  pthreadpool_t threadpool = pthreadpool_create(0);\n  assert(threadpool != NULL);\n\n  const size_t threads_count = pthreadpool_get_threads_count(threadpool);\n  printf(\"Created thread pool with %zu threads\\n\", threads_count);\n\n  struct array_addition_context context = { augend, addend, sum };\n  pthreadpool_parallelize_1d(threadpool,\n    (pthreadpool_task_1d_t) add_arrays,\n    (void*) \u0026context,\n    ARRAY_SIZE,\n    PTHREADPOOL_FLAG_DISABLE_DENORMALS /* flags */);\n\n  pthreadpool_destroy(threadpool);\n  threadpool = NULL;\n\n  printf(\"%8s\\t%.2lf\\t%.2lf\\t%.2lf\\t%.2lf\\n\", \"Augend\",\n    augend[0], augend[1], augend[2], augend[3]);\n  printf(\"%8s\\t%.2lf\\t%.2lf\\t%.2lf\\t%.2lf\\n\", \"Addend\",\n    addend[0], addend[1], addend[2], addend[3]);\n  printf(\"%8s\\t%.2lf\\t%.2lf\\t%.2lf\\t%.2lf\\n\", \"Sum\",\n    sum[0], sum[1], sum[2], sum[3]);\n\n  return 0;\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMaratyszcza%2Fpthreadpool","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FMaratyszcza%2Fpthreadpool","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FMaratyszcza%2Fpthreadpool/lists"}