{"id":17870724,"url":"https://github.com/jtsiomb/c11threads","last_synced_at":"2025-04-06T09:09:17.789Z","repository":{"id":4822334,"uuid":"5976149","full_name":"jtsiomb/c11threads","owner":"jtsiomb","description":"Portable C11 threads implementation over POSIX threads and win32 threads.","archived":false,"fork":false,"pushed_at":"2024-09-17T18:32:44.000Z","size":45,"stargazers_count":242,"open_issues_count":1,"forks_count":36,"subscribers_count":11,"default_branch":"master","last_synced_at":"2025-03-30T07:08:34.643Z","etag":null,"topics":["c11","pthreads","threads","unix","win32"],"latest_commit_sha":null,"homepage":"","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/jtsiomb.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,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2012-09-27T02:37:20.000Z","updated_at":"2025-03-02T13:40:00.000Z","dependencies_parsed_at":"2024-10-28T10:41:58.158Z","dependency_job_id":"8b5854bc-cc48-49d4-ab89-cdc165261d5b","html_url":"https://github.com/jtsiomb/c11threads","commit_stats":{"total_commits":38,"total_committers":10,"mean_commits":3.8,"dds":0.6052631578947368,"last_synced_commit":"ec95e1aa82079aefe109d18e5069b79711692064"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtsiomb%2Fc11threads","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtsiomb%2Fc11threads/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtsiomb%2Fc11threads/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jtsiomb%2Fc11threads/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jtsiomb","download_url":"https://codeload.github.com/jtsiomb/c11threads/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247457803,"owners_count":20941906,"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":["c11","pthreads","threads","unix","win32"],"created_at":"2024-10-28T10:18:44.401Z","updated_at":"2025-04-06T09:09:17.770Z","avatar_url":"https://github.com/jtsiomb.png","language":"C","readme":"Trivial C11 `threads.h` implementation over POSIX threads, and not-so-trivial\nimplementation over Win32 threads.\n\n\nRationale\n---------\nEven though GCC provides the threading features required by the C11 standard\n(like atomics, and thread-local storage), GNU libc, still does not implement the\nnecessary library functions of the standard C thread API. Other popular\nplatforms similarly lack support for the C11 thread functions, like Microsoft's\nC runtime library on Windows.\n\nIf you're starting a new multithreaded project in C right now, it would make\nsense to use the standard C way of using threads instead of a mishmash of\nvarious platform-specific APIs. So until the system libc adds support for it,\nwe need a stopgap that works exactly as the C standard describes.\n\n\nLicense\n-------\nAuthors:\n  - John Tsiombikas \u003cnuclear@member.fsf.org\u003e: original POSIX threads wrapper\n  - Oliver Old \u003coliver.old@outlook.com\u003e: win32 implementation\n\nI place this piece of code in the public domain. Feel free to use as you see\nfit. I'd appreciate it if you keep my name at the top of the code somewhere, but\nwhatever.\n\n\nHow to use\n----------\n### With POSIX threads\nOn UNIX systems, or on Windows with a 3rd party pthreads library, c11threads\nis implemented as a thin wrapper of static inline functions over pthreads.\n\nNo installation or compilation necessary; just drop `c11threads.h` into your\nproject source tree, and don't forget to link with `-lpthread`. On some\nplatforms it might be required to also pass the `-pthread` flag to the compiler.\n\nIf your compiler does not support the inline keyword, define `C11THREADS_INLINE`\nto whatever equivalent keyword the compiler provides, or to the empty string to\nmake all the functions simply static.\n\nIf you wish to use the pthreads implementation on Windows, in preference to the\nnative win32 one, you need to define `C11THREADS_PTHREAD_WIN32`.\n\n### With Win32 threads\nTo use C11 threads over the Windows threads API, beyond adding `c11threads.h` to\nyour project, you also need to compile `c11threads_win32.c` as part of your\nbuild. Additionally, if you're in a situation where letting c11threads keep\nresources for the duration of the process lifetime is not desirable, you can\ncall `c11threads_destroy_win32()` to free them manually at any point, when\nyou're done with it.\n\n### Test program\nThere's a simple test program under `test/`. To build it on UNIX (GNU/Linux,\nFreeBSD, MacOSX, whatever), simply change into the test directory and type\n`make`.\n\nTo build the test program on Windows with MSVC using native win32 threads,\nsetup the build environment (usually there's a batch file called `vcvars*.bat`,\nrun it in a console), and use microsoft nmake to build:\n`nmake -f Makefile.msvc`.\n\nContact\n-------\nMain project site: https://github.com/jtsiomb/c11threads\n\nFeel free to send corrections, patches, trendy social pull requests,\npictures of your cat wearing santa hats, any good porn links, or investment\nopportunities with Nigerian ex-royals... It's all good.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtsiomb%2Fc11threads","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjtsiomb%2Fc11threads","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjtsiomb%2Fc11threads/lists"}