Code Monkey home page Code Monkey logo

c11threads's Introduction

Trivial C11 threads.h implementation over POSIX threads.

Rationale
---------
GNU libc doesn't implement the thread part of the C library from the recent C11
standard, even though recent versions of gcc do support other aspects of it
(like atomics).

If you're starting a new multithreaded project in C right now, it would make
sense to use the standard C way of using threads instead of a mismash of
various platform-specific APIs.

So until the system libc adds support for it, we need a stopgap that works
exactly as the C standard describes.


How to use
----------
No installation, no compilation, just drop c11threads.h to your project, and
don't forget to link with -lpthread

This library is extremely thin and implemented directly in the header file as a
bunch of "static inline" functions (you do have at least C99 functionality while
trying to use C11 threads, right?).

If you'd like to use this with a C89 compiler, just search&replace or
define-away all instances of "inline" to oblivion. Each object file will get a
copy of all those static functions but that shouldn't be too cumbersome for a
reasonably modern system (say anything after the 80s).

License
-------
Author: John Tsiombikas <[email protected]>
I place this piece of code in the public domain. Feel free to use as you see
fit. I'd appreciate it if you keep my name at the top of the code somehwere, but
whatever.

Main project site: https://github.com/jtsiomb/c11threads

Feel free to send corrections, patches, trendy social pull requests,
pictures of your cat wearing santa hats, any good porn links, or investment
opportunities with nigerian ex-royals... it's all good.

c11threads's People

Contributors

gjmvervoort avatar jtsiomb avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.