Skip to content

cdwfs/cds_sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 

Repository files navigation

cds_sync

This single header file C90 library provides a portable collection of synchronization primitives for use in multithreaded programming. The following primitives are provided:

  • cds_sync_futex_t -- A futex (fast userspace mutex), guaranteed to stay in userspace code unless a thread must be put to sleep or awakened.
  • cds_sync_fusem_t -- A fast userspace semaphore, guaranteed to stay in userspace code unless a thread must be put to sleep or awakened.
  • cds_sync_monitor_t -- A monitor, which bundles a condition variable and its associated mutex.
  • cds_sync_eventcount_t -- An event count which lets callers safely avoid waiting unless there's actually no work to do.
  • cds_sync_monsem_t -- A monitored semaphore, which builds on the basic semaphore by allowing a master thread to wait for the semaphore to have a certain positive non-zero value.
  • cds_sync_barrier_t -- Lets users specify a barrier that all threads must reach before any thread can proceed.

Key Features / Design Goals

  • Identical API on all supported platforms. The following platforms are tested regularly:
    • Microsoft Windows 7
      • Visual Studio 2010
      • Visual Studio 2012
      • Visual Studio 2013
    • Linux Mint
      • LLVM/Clang 3.5
      • gcc 4.8.4
    • Apple OSX
      • Apple LLVM/Clang 6.1.0
  • No (mandatory) external dependencies. Only standard C library functions are used, and even those can be overriden with custom implementations through #defines if desired.
  • Dirt-simple integration. Just a single header file to include in your project.
  • Public domain license terms.

Acknowledgements

About

Single-header C90 collection of synchronization primitives

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages