mirror of
https://github.com/haproxy/haproxy.git
synced 2026-02-20 00:10:41 -05:00
MINOR: threads: Only consider running threads to end a thread harmeless period
When a thread ends its harmeless period, we must only consider running threads when testing threads_want_rdv_mask mask. To do so, we reintroduce all_threads_mask mask in the bitwise operation (It was removed to fix a deadlock). Note that for now it is useless because there is no way to stop threads or to have threads reserved for another task. But it is safer this way to avoid bugs in the future.
This commit is contained in:
parent
f63a185500
commit
76b44195c9
2 changed files with 2 additions and 2 deletions
|
|
@ -265,7 +265,7 @@ static inline void thread_harmless_end()
|
|||
{
|
||||
while (1) {
|
||||
HA_ATOMIC_AND(&threads_harmless_mask, ~tid_bit);
|
||||
if (likely((threads_want_rdv_mask & ~tid_bit) == 0))
|
||||
if (likely((threads_want_rdv_mask & all_threads_mask & ~tid_bit) == 0))
|
||||
break;
|
||||
thread_harmless_till_end();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ struct lock_stat lock_stats[LOCK_LABELS];
|
|||
void thread_harmless_till_end()
|
||||
{
|
||||
_HA_ATOMIC_OR(&threads_harmless_mask, tid_bit);
|
||||
while (threads_want_rdv_mask & ~tid_bit) {
|
||||
while (threads_want_rdv_mask & all_threads_mask & ~tid_bit) {
|
||||
ha_thread_relax();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue