carb/container/LocklessStack.h¶
↰ Parent directory: carb/container/
Defines the LocklessStack class.
Source: carb/container/LocklessStack.h
Included By¶
carb/extras/HandleDatabase.h: HandleDatabase definition file.
Namespaces¶
carb: The main Carbonite namespace.
carb::container: Carbonite container classes.
Classes¶
carb::container::LocklessStack: Implements a lockless stack: a LIFO container that is thread-safe yet requires no kernel involvement.
carb::container::LocklessStackLink: Defines the link object.
Defines¶
CARB_LOCKLESSSTACK_IS_LOCKLESS: On non-Windows platforms we fallback to a non-Lockless version that uses a mutex. This is because handling a pop() requires potentially catching a SIGSEGV to restart the operation (similar to a cmpxchg failing). On Windows this is easily done with SEH (Structured Exception Handling), but on Linux this requires a signal handler. If this file is compiled into multiple dynamic objects then multiple signal handlers will be registered. Furthermore, the signal handler of the currently active LocklessStack needs to be at the beginning of the handler chain. This is untenable from a performance perspective. Therefore we use a mutex to ensure that all reads will be safe.