@@ -12,17 +12,17 @@ using concurrencpp::worker_thread_executor;
12
12
worker_thread_executor::worker_thread_executor (const std::function<void (std::string_view thread_name)>& thread_started_callback,
13
13
const std::function<void(std::string_view thread_name)>& thread_terminated_callback) :
14
14
derivable_executor<concurrencpp::worker_thread_executor>(details::consts::k_worker_thread_executor_name),
15
- m_private_atomic_abort(false ), m_abort(false ), m_status (details::queue_status::empty), m_thread_started_callback(thread_started_callback),
15
+ m_private_atomic_abort(false ), m_abort(false ), m_public_queue_status (details::queue_status::empty), m_thread_started_callback(thread_started_callback),
16
16
m_thread_terminated_callback(thread_terminated_callback) {}
17
17
18
18
void worker_thread_executor::notify_task_exists () noexcept {
19
19
auto expected = details::queue_status::empty;
20
- const auto swapped = m_status .compare_exchange_strong (expected,
20
+ const auto swapped = m_public_queue_status .compare_exchange_strong (expected,
21
21
details::queue_status::task_available,
22
22
std::memory_order_relaxed,
23
23
std::memory_order_relaxed);
24
24
if (swapped) {
25
- details::atomic_notify_one (m_status );
25
+ details::atomic_notify_one (m_public_queue_status );
26
26
}
27
27
}
28
28
@@ -56,7 +56,7 @@ void worker_thread_executor::work_loop() {
56
56
57
57
auto yield_fn = [this ]() noexcept -> bool {
58
58
for (size_t i = 0 ; i < 2 * 1024 ; i++) {
59
- const auto status = m_status .load (std::memory_order_relaxed);
59
+ const auto status = m_public_queue_status .load (std::memory_order_relaxed);
60
60
if (status != details::queue_status::empty) {
61
61
return true ;
62
62
}
@@ -70,13 +70,13 @@ void worker_thread_executor::work_loop() {
70
70
while (true ) {
71
71
assert (m_private_queue.empty ());
72
72
73
- auto status = m_status .load (std::memory_order_relaxed);
73
+ auto status = m_public_queue_status .load (std::memory_order_relaxed);
74
74
if (status == details::queue_status::abort) {
75
75
return ;
76
76
}
77
77
78
78
if (status == details::queue_status::task_available) {
79
- const auto swapped = m_status .compare_exchange_strong (status,
79
+ const auto swapped = m_public_queue_status .compare_exchange_strong (status,
80
80
details::queue_status::empty,
81
81
std::memory_order_relaxed,
82
82
std::memory_order_relaxed);
@@ -103,7 +103,7 @@ void worker_thread_executor::work_loop() {
103
103
}
104
104
105
105
assert (status == details::queue_status::empty);
106
- details::atomic_wait (m_status , details::queue_status::empty, std::memory_order_relaxed);
106
+ details::atomic_wait (m_public_queue_status , details::queue_status::empty, std::memory_order_relaxed);
107
107
}
108
108
}
109
109
@@ -124,7 +124,7 @@ void worker_thread_executor::enqueue_local(std::span<concurrencpp::task> tasks)
124
124
}
125
125
126
126
void worker_thread_executor::enqueue_foreign (concurrencpp::task& task) {
127
- if (m_status .load (std::memory_order_relaxed) == details::queue_status::abort) {
127
+ if (m_public_queue_status .load (std::memory_order_relaxed) == details::queue_status::abort) {
128
128
details::throw_runtime_shutdown_exception (name);
129
129
}
130
130
@@ -145,7 +145,7 @@ void worker_thread_executor::enqueue_foreign(concurrencpp::task& task) {
145
145
}
146
146
147
147
void worker_thread_executor::enqueue_foreign (std::span<concurrencpp::task> tasks) {
148
- if (m_status .load (std::memory_order_relaxed) == details::queue_status::abort) {
148
+ if (m_public_queue_status .load (std::memory_order_relaxed) == details::queue_status::abort) {
149
149
details::throw_runtime_shutdown_exception (name);
150
150
}
151
151
@@ -186,18 +186,18 @@ int worker_thread_executor::max_concurrency_level() const noexcept {
186
186
}
187
187
188
188
bool worker_thread_executor::shutdown_requested () const {
189
- return m_status .load (std::memory_order_relaxed) == details::queue_status::abort;
189
+ return m_public_queue_status .load (std::memory_order_relaxed) == details::queue_status::abort;
190
190
}
191
191
192
192
void worker_thread_executor::shutdown () {
193
- const auto status = m_status .exchange (details::queue_status::abort, std::memory_order_relaxed);
193
+ const auto status = m_public_queue_status .exchange (details::queue_status::abort, std::memory_order_relaxed);
194
194
if (status == details::queue_status::abort) {
195
195
return ; // shutdown had been called before.
196
196
}
197
197
198
198
m_private_atomic_abort.store (true , std::memory_order_relaxed);
199
199
200
- details::atomic_notify_one (m_status );
200
+ details::atomic_notify_one (m_public_queue_status );
201
201
202
202
decltype (m_thread) worker;
203
203
{
0 commit comments