]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: threads: avoid clearing harmless twice in thread_release()
authorWilly Tarreau <w@1wt.eu>
Sun, 9 Jun 2019 06:44:19 +0000 (08:44 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 9 Jun 2019 06:47:35 +0000 (08:47 +0200)
thread_release() is to be called after thread_isolate(), i.e. when the
thread already has its harmless bit cleared. No need to clear it twice,
thus avoid calling thread_harmless_end() and directly check the rdv
bits then loop on them.

src/hathreads.c

index 8359dd5ebb7c9f0fb05180ffe58cd4e1a34537ee..006a0896d97116f637facc3fa6fd0766ea94e9ee 100644 (file)
@@ -94,7 +94,12 @@ void thread_isolate()
 void thread_release()
 {
        _HA_ATOMIC_AND(&threads_want_rdv_mask, ~tid_bit);
-       thread_harmless_end();
+       while (threads_want_rdv_mask & all_threads_mask) {
+               _HA_ATOMIC_OR(&threads_harmless_mask, tid_bit);
+               while (threads_want_rdv_mask & all_threads_mask)
+                       ha_thread_relax();
+               HA_ATOMIC_AND(&threads_harmless_mask, ~tid_bit);
+       }
 }
 
 /* send signal <sig> to thread <thr> */