|
Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
|
Dynamic circular array for work-stealing deque. More...
#include <work_stealing_deque.h>


Public Member Functions | |
| circular_array (std::size_t log_size) | |
| Constructs a circular array with given capacity. | |
| ~circular_array () | |
| circular_array (const circular_array &)=delete | |
| circular_array & | operator= (const circular_array &)=delete |
| std::size_t | size () const noexcept |
| Get the capacity of the array. | |
| T | get (std::int64_t index) const noexcept |
| Get element at index with relaxed memory ordering. | |
| void | put (std::int64_t index, T value) noexcept |
| Store element at index with relaxed memory ordering. | |
| circular_array * | grow (std::int64_t bottom, std::int64_t top) const |
| Create a new array with double the capacity, copying elements. | |
Private Attributes | |
| std::size_t | log_size_ |
| std::size_t | size_ |
| std::size_t | mask_ |
| std::atomic< T > * | buffer_ |
Dynamic circular array for work-stealing deque.
This class provides a resizable circular buffer used internally by the work-stealing deque. It supports lock-free growth operations.
| T | Element type stored in the array |
Definition at line 33 of file work_stealing_deque.h.
|
inlineexplicit |
Constructs a circular array with given capacity.
| log_size | Log base 2 of the capacity (capacity = 2^log_size) |
Definition at line 39 of file work_stealing_deque.h.
References kcenon::thread::lockfree::circular_array< T >::buffer_, and kcenon::thread::lockfree::circular_array< T >::size_.
Referenced by kcenon::thread::lockfree::circular_array< T >::grow().

|
inline |
Definition at line 49 of file work_stealing_deque.h.
References kcenon::thread::lockfree::circular_array< T >::buffer_.
|
delete |
|
inlinenodiscardnoexcept |
Get element at index with relaxed memory ordering.
| index | Array index (will be masked for circular access) |
Definition at line 70 of file work_stealing_deque.h.
References kcenon::thread::lockfree::circular_array< T >::buffer_, and kcenon::thread::lockfree::circular_array< T >::mask_.
Referenced by kcenon::thread::lockfree::circular_array< T >::grow(), kcenon::thread::lockfree::work_stealing_deque< T >::pop(), kcenon::thread::lockfree::work_stealing_deque< T >::steal(), and kcenon::thread::lockfree::work_stealing_deque< T >::steal_batch().

|
inlinenodiscard |
Create a new array with double the capacity, copying elements.
| bottom | Current bottom index |
| top | Current top index |
Definition at line 89 of file work_stealing_deque.h.
References kcenon::thread::lockfree::circular_array< T >::circular_array(), kcenon::thread::lockfree::circular_array< T >::get(), and kcenon::thread::lockfree::circular_array< T >::log_size_.
Referenced by kcenon::thread::lockfree::work_stealing_deque< T >::push().


|
delete |
|
inlinenoexcept |
Store element at index with relaxed memory ordering.
| index | Array index (will be masked for circular access) |
| value | Value to store |
Definition at line 79 of file work_stealing_deque.h.
References kcenon::thread::lockfree::circular_array< T >::buffer_, and kcenon::thread::lockfree::circular_array< T >::mask_.
Referenced by kcenon::thread::lockfree::work_stealing_deque< T >::push().

|
inlinenodiscardnoexcept |
Get the capacity of the array.
Definition at line 61 of file work_stealing_deque.h.
References kcenon::thread::lockfree::circular_array< T >::size_.
Referenced by kcenon::thread::lockfree::work_stealing_deque< T >::push().

|
private |
Definition at line 101 of file work_stealing_deque.h.
Referenced by kcenon::thread::lockfree::circular_array< T >::circular_array(), kcenon::thread::lockfree::circular_array< T >::get(), kcenon::thread::lockfree::circular_array< T >::put(), and kcenon::thread::lockfree::circular_array< T >::~circular_array().
|
private |
Definition at line 98 of file work_stealing_deque.h.
Referenced by kcenon::thread::lockfree::circular_array< T >::grow().
|
private |
Definition at line 100 of file work_stealing_deque.h.
Referenced by kcenon::thread::lockfree::circular_array< T >::get(), and kcenon::thread::lockfree::circular_array< T >::put().
|
private |
Definition at line 99 of file work_stealing_deque.h.
Referenced by kcenon::thread::lockfree::circular_array< T >::circular_array(), and kcenon::thread::lockfree::circular_array< T >::size().