ATOMIC_POINTER_LOCK_FREE
is a macro defined in the C11 atomic library. Since it is atomic, it is guaranteed to have no race conditions when accessed by multiple threads.
The macro takes on the value , , or depending on whether the type is lock-free:
Lock-free programming can be used alternatively to the mutex
and semaphores
for concurrent. Instead of using locking mechanisms to block threads from accessing data or putting them to sleep (as is the case with mutex
), lock-free
programming allows atomic
operations on the data using a transactional memory model.
The transactional memory model bunches up a series of memory accesses and implements them at once as a transaction, which is similar to how transactions in databases work.
Lock-free programming is non-blocking, which allows lock-free programs to access shared resources without blocking other threads and introducing race conditions. The non-blocking property of lock-free programming carries many performance advantages over mutex
locks because concurrent access to resources is not blocked by other threads accessing the same data.
Free Resources