CsLibGuarded  1.4.2
API Overview

There are various classes in CsLibGuarded and although most of them can be used interchangeably, some of the classes are a better fit for specific use cases.

  • class plain_guarded<T>
    • implements exclusive locks
    • only one thread can access the data at a time

  • class shared_guarded<T>
    • implements exclusive locks and shared locks
    • single writer, multiple readers
    • writers must wait for readers, readers must wait for writers
    • optimal class when a simple read / write lock is desired

  • class ordered_guarded<T>
    • implements shared locks
    • single writer, multiple readers
    • writers must wait for readers, readers must wait for writers
    • modifications to shared data by passing a lambda expression or a function object
  • class deferred_guarded<T>
    • implements shared locks
    • nonblocking modifications to data using a lambda expression
    • deferring updates ensures deadlocks do not occur
    • uses extra memory to store pending updates
    • optimal class when updates do not need to occur in a particular order

  • class lr_guarded<T>
    • implements lock free shared access
    • blocking modifications to data using a lambda expression
    • single writer, multiple readers
    • readers never have to wait for writers
    • writers must wait for readers and other writers
    • stores two copies of T
    • optimal class when the size of a T is relatively small and writes are not common

  • class cow_guarded<T>
    • implements lock free shared access
    • writers can roll back modifications
    • single writer, multiple readers
    • readers never have to wait for writers
    • writers must wait for other writers
    • writer can roll back changes
    • optimal class when the size of a T is relatively large and writes are not common

  • class rcu_guarded<T>
    • implements an rcu (read/copy/update) data structures
    • thread safe list
    • single writer, multiple readers
    • readers never have to wait for writers
    • iterators are never invalidated
    • optimal class when you need to guard a container