๐Ÿ“จ chic 0.0.0
Realtime-safe channels in C
Loading...
Searching...
No Matches
๐Ÿ“จ chic

Buffered channels, such as the Go programming language's chan or Plan 9's Channel, written in C17.

These channels are suitable for inter-process communication in realtime applications as they do not use mutex, semaphore, or anything else that blocks or requires a context switch. They synchronize using atomic operations only. They are intended to have better/bounded worst-case performance, even at the expense of average-case performance.

These channels support sending and receiving batches of items, and also provide methods to safely read and write directly to their underlying ringbuffer for zero-copy communication.

Chic provides four flavors of channels:

  • Multiple-producer, multiple-consumer: If you're not sure what you need, use this one. This is most similar to Go's chan.
  • Multiple-producer, single-consumer (work-in-progress): Receiving from the channel is optimized under the assumption that only one thread receives from the channel.
  • Single-producer, multiple-consumer (work-in-progress): Sending to the channel is optimized under the assumption that only one thread sends to the channel.
  • Single-producer, single-consumer (work-in-progress): All channel operations are optimized under the assumption that only one thread sends to the channel and only one thread receives from the channel.

Usage

Chic is incomplete and is unsuitable for use at this point in time. The current focus is making sure the MPMC queue is correct and performant, after which the other queue types can be derived from it and then optimized in their own ways.

Building

Chic depends on the CMake build system and the presence of a compiler that supports both C17 and <stdatomic.h>.

Build Chic as a static library:

cmake -B build && cmake --build build

Build Chic as a dynamic library:

cmake -DBUILD_SHARED_LIBS=ON -B build && cmake --build build

Documentation

Documentation is available at rubiefawn.codeberg.page/chic.

HTML documentation can be built locally if you have Doxygen installed by running:

cmake -B build && cmake --build build --target docs

License

Chic is subject to the terms of the Mozilla Public License, v. 2.0.

Resources

๐Ÿ“ฎ Blog Posts

๐Ÿ“บ Videos

๐Ÿ“ƒ Papers

๐Ÿ”– Miscellaneous