{"id":14976797,"url":"https://github.com/mp81ss/ctp","last_synced_at":"2025-06-14T19:38:41.913Z","repository":{"id":194978411,"uuid":"356897715","full_name":"mp81ss/ctp","owner":"mp81ss","description":"C-Thread-Pool, the universal thread pool library","archived":false,"fork":false,"pushed_at":"2023-09-15T10:31:11.000Z","size":14,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-19T22:59:26.092Z","etag":null,"topics":["bsd","c","cross-platform","linux","multi-threaded","multi-threading","multithreading","pool","thread","thread-pool","threading","threadpool","threads","win32","windows","windows-10","windows-7"],"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/mp81ss.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}},"created_at":"2021-04-11T14:59:28.000Z","updated_at":"2024-12-30T07:30:43.000Z","dependencies_parsed_at":"2023-09-16T03:21:41.994Z","dependency_job_id":null,"html_url":"https://github.com/mp81ss/ctp","commit_stats":null,"previous_names":["mp81ss/ctp"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mp81ss/ctp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp81ss%2Fctp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp81ss%2Fctp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp81ss%2Fctp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp81ss%2Fctp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mp81ss","download_url":"https://codeload.github.com/mp81ss/ctp/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mp81ss%2Fctp/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":259872758,"owners_count":22924630,"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":["bsd","c","cross-platform","linux","multi-threaded","multi-threading","multithreading","pool","thread","thread-pool","threading","threadpool","threads","win32","windows","windows-10","windows-7"],"created_at":"2024-09-24T13:54:28.430Z","updated_at":"2025-06-14T19:38:41.885Z","avatar_url":"https://github.com/mp81ss.png","language":"C","readme":"# ARCHIVED - Moved to gitlab\n\n\n# ARCHIVED - Moved to gitlab\n\n\n# CTP\n## The universal C-Thread-Pool library\n\n*CTP* is a C library that offers a pool thread, based on _pthread_, that is the only dependency.\\\nWhile easy to use, it has some interesting features:\n\n### Features\n- Cross platform: Standard C; Windows, linux, bsd; 32/64 bit\n- Can spawn the best number of threads according to detected cpu\n- Lazy thread activation\n- Ability to pause/resume\n- Automatic/custom queue size\n- Can block when adding work or discard if queue is full (best effort)\n- Possibility to know how many threads were effectively spawned\n- Dedicated API to query status in any moment (paused/idle/working)\n- Easy transition from _pthread_, the work prototype has the same signature\n\n### Installation\nJust compile the .c file and add it to your linker, as object or library.\nIf using gcc/clang, remember to complie with _-pthread_ and link with _-lpthread_\n\nIf you want to use visual studio, or other windows compiler, use package\n\u003chttps://sourceware.org/pthreads-win32\u003e\n\n### Configuration\nWhile compiling ctp (The library, not the clients), you can pass these variables:\n- CTP_DEFAULT_THREADS_NUM\n- CTP_MULTIPLY_QUEUE_FACTOR\n- CTP_MIN_QUEUE_SIZE\n\n_CTP_DEFAULT_THREADS_NUM_ is used only if you pass 0 to init, and _ctp_ fails to detect core number.\\\nIn this case, _CTP_DEFAULT_THREADS_NUM_ threads will be used. Default is **4**.\\\nIf you pass 0 to init in the second parameter, the queue size will be calculated according to 3 parameters:\\\n_threads-num_, _CTP_MULTIPLY_QUEUE_FACTOR_ and _CTP_MIN_QUEUE_SIZE_. The formula is:\\\n```max(threads-num * CTP_MULTIPLY_QUEUE_FACTOR, CTP_MIN_QUEUE_SIZE)```\\\nThe default value for _CTP_MULTIPLY_QUEUE_FACTOR_ is **8**.\\\nThe default value for _CTP_MIN_QUEUE_SIZE_ is **256**\n\n---\n\nFor API details see header file. Test file may help too\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmp81ss%2Fctp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmp81ss%2Fctp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmp81ss%2Fctp/lists"}