|
Thread System 0.3.1
High-performance C++20 thread pool with work stealing and DAG scheduling
|
Global hazard pointer registry Manages all thread-local hazard lists. More...
#include <hazard_pointer.h>

Public Member Functions | |
| thread_hazard_list * | get_thread_list () |
| Get or create thread-local hazard list. | |
| void | mark_inactive () |
| Mark current thread's list as inactive. | |
| std::vector< void * > | scan_hazard_pointers () |
| Scan all hazard pointers and collect protected pointers. | |
| size_t | get_active_thread_count () const |
| Get total number of active threads. | |
Static Public Member Functions | |
| static hazard_pointer_registry & | instance () |
Private Member Functions | |
| hazard_pointer_registry ()=default | |
Private Attributes | |
| std::atomic< thread_hazard_list * > | head_ {nullptr} |
| std::atomic< size_t > | thread_count_ {0} |
Global hazard pointer registry Manages all thread-local hazard lists.
Definition at line 58 of file hazard_pointer.h.
|
privatedefault |
| size_t kcenon::thread::detail::hazard_pointer_registry::get_active_thread_count | ( | ) | const |
Get total number of active threads.
Definition at line 143 of file hazard_pointer.cpp.
References thread_count_.
| thread_hazard_list * kcenon::thread::detail::hazard_pointer_registry::get_thread_list | ( | ) |
Get or create thread-local hazard list.
Definition at line 22 of file hazard_pointer.cpp.
References kcenon::thread::detail::thread_hazard_list::active, head_, kcenon::thread::detail::thread_hazard_list::next, and thread_count_.
Referenced by kcenon::thread::hazard_pointer::hazard_pointer(), and mark_inactive().

|
static |
Definition at line 16 of file hazard_pointer.cpp.
Referenced by kcenon::thread::hazard_pointer_domain< T >::get_stats(), kcenon::thread::hazard_pointer::hazard_pointer(), kcenon::thread::hazard_pointer_domain< T >::reclaim(), and kcenon::thread::hazard_pointer_domain< T >::thread_retire_list::reclaim_all().

| void kcenon::thread::detail::hazard_pointer_registry::mark_inactive | ( | ) |
Mark current thread's list as inactive.
Definition at line 75 of file hazard_pointer.cpp.
References kcenon::thread::detail::thread_hazard_list::active, get_thread_list(), kcenon::thread::detail::thread_hazard_list::hazards, and thread_count_.

| std::vector< void * > kcenon::thread::detail::hazard_pointer_registry::scan_hazard_pointers | ( | ) |
Scan all hazard pointers and collect protected pointers.
Definition at line 91 of file hazard_pointer.cpp.
References kcenon::thread::detail::thread_hazard_list::active, kcenon::thread::detail::thread_hazard_list::hazards, head_, and kcenon::thread::detail::thread_hazard_list::next.
|
private |
Definition at line 77 of file hazard_pointer.h.
Referenced by get_thread_list(), and scan_hazard_pointers().
|
private |
Definition at line 78 of file hazard_pointer.h.
Referenced by get_active_thread_count(), get_thread_list(), and mark_inactive().