BUG/MAJOR: thread: Be sure to request a sync between threads only once at a time

The first thread requesting a synchronization is responsible to write in the
"sync" pipe to notify all others. But we must write only once in the pipe
between two synchronizations to have exactly one character in the pipe. It is
important because we only read 1 character in return when the last thread exits
from the sync-point.

Here there is a bug. If two threads request a synchronization, only the first
writes in the pipe. But, if the same thread requests several times a
synchronization before entering in the sync-point (because, for instance, it
detects many servers down), it writes as many as characters in the pipe. And
only one of them will be read. Repeating this bug many times will block HAProxy
on the write because the pipe is full.

To fix the bug, we just check if the current thread has already requested a
synchronization before trying to notify all others.

The patch must be backported in 1.8
diff --git a/src/hathreads.c b/src/hathreads.c
index eb9cd3f..50f3c77 100644
--- a/src/hathreads.c
+++ b/src/hathreads.c
@@ -70,6 +70,8 @@
 void thread_want_sync()
 {
 	if (all_threads_mask) {
+		if (threads_want_sync & tid_bit)
+			return;
 		if (HA_ATOMIC_OR(&threads_want_sync, tid_bit) == tid_bit)
 			shut_your_big_mouth_gcc(write(threads_sync_pipe[1], "S", 1));
 	}