Open 3D Engine AzCore API Reference 23.10.0
O3DE is an open-source, fully-featured, high-fidelity, modular 3D engine for building games and simulations, available to every industry.
AZStd::lock_free_intrusive_stack< T, Hook > Class Template Reference

#include <lock_free_intrusive_stack.h>

Public Types

typedef T * pointer
 
typedef const T * const_pointer
 
typedef T & reference
 
typedef const T & const_reference
 
typedef AZStd::size_t difference_type
 
typedef AZStd::size_t size_type
 
typedef T value_type
 
typedef T node_type
 
typedef node_type * node_ptr_type
 
typedef lock_free_intrusive_stack_node< T > hook_node_type
 
typedef hook_node_typehook_node_ptr_type
 

Public Member Functions

void push (const_reference value)
 Pushes a value onto the top of the stack.
 
pointer pop ()
 
bool empty () const
 Tests if the stack is empty, limited utility for a concurrent container.
 

Detailed Description

template<typename T, typename Hook>
class AZStd::lock_free_intrusive_stack< T, Hook >

A lock-free intrusive stack implementation. The stored type must either inherit from lock_free_intrusive_stack_node or include it as a member, and the appropriate hook type must be specified.

IMPORTANT NOTE: This stack implementation is vulnerable to the ABA problem. Since the nodes are managed by the user, it is up to the user to ensure that the ABA problem does not occur. DO NOT USE THIS STACK UNLESS YOU THOROUGHLY UNDERSTAND THE ABA PROBLEM, YOU WILL RANDOMLY CORRUPT THE STACK AND CAUSE CRASHES. Use the lock_free_intrusive_stamped_stack instead as it does not suffer from the ABA problem.

Member Function Documentation

◆ pop()

template<typename T , typename Hook >
lock_free_intrusive_stack< T, Hook >::pointer AZStd::lock_free_intrusive_stack< T, Hook >::pop
inline

Attempts to pop a value from the top of the stack. Returns NULL if the stack was empty, otherwise returns a pointer to the popped value


The documentation for this class was generated from the following file: