https://github.com/danengelbrecht/atomicindexpool
Single header library for an Atomic (lock-free) index pool
https://github.com/danengelbrecht/atomicindexpool
Last synced: 3 months ago
JSON representation
Single header library for an Atomic (lock-free) index pool
- Host: GitHub
- URL: https://github.com/danengelbrecht/atomicindexpool
- Owner: DanEngelbrecht
- License: mit
- Created: 2019-04-07T08:28:29.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-29T13:01:40.000Z (about 7 years ago)
- Last Synced: 2025-12-26T09:58:10.257Z (7 months ago)
- Language: C++
- Size: 31.3 KB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
|Branch | OSX / Linux / Windows |
|------------|---------|
|master | [](https://travis-ci.org/DanEngelbrecht/AtomicIndexPool?branch=master) |
# AtomicIndexPool
Single header library for an Atomic (lock-free) index pool
Builds with MSVC, Clang and GCC.
Minimal dependencies - only requires `` and ``, the default (optional) MSVC implementation depends on ``.
The default implementations for the atomic functions can be overridden with your own implementation by overriding the macros
- `ATOMICINDEXPOOL_ATOMICADD` Atomically adds a 32-bit signed integer to another 32-bit signed integer and returns the result
- `ATOMICINDEXPOOL_ATOMICCAS` Atomically exchange a 32-bit signed integer with another 32-bit signed integer if the value to be swapped matches the provided compare value, returns the old value.
You are responsible for allocating and deallocating required memory, you can ask how much is needed.
Limited to 8 388 607 entries in the index pool.
The pool indexes are starts at 1, so to use the result in C arrays, use index - 1.