From: Willy Tarreau Date: Thu, 2 Aug 2018 08:54:31 +0000 (+0200) Subject: MEDIUM: haproxy: don't use sync_poll_loop() anymore in the main loop X-Git-Tag: v1.9-dev2~185 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=85c459d7e82249bf99125e081cd8232c881e41f5;p=thirdparty%2Fhaproxy.git MEDIUM: haproxy: don't use sync_poll_loop() anymore in the main loop This partially reverts commit d8fd2af ("BUG/MEDIUM: threads: Use the sync point to check active jobs and exit") which used to address an issue in the way the sync point used to check for present threads, which was later addressed by commit ddb6c16 ("BUG/MEDIUM: threads: Fix the exit condition of the thread barrier"). Thus there is no need anymore to use the sync point for exiting and we can completely remove this call in the main loop. --- diff --git a/src/haproxy.c b/src/haproxy.c index fcba6cd222..5f56c0a363 100644 --- a/src/haproxy.c +++ b/src/haproxy.c @@ -2385,24 +2385,6 @@ static inline void servers_check_for_updates() } } -static int sync_poll_loop() -{ - int stop = 0; - - if (THREAD_NO_SYNC()) - return stop; - - THREAD_ENTER_SYNC(); - - if (!THREAD_NEED_SYNC()) - goto exit; - - exit: - stop = (jobs == 0); /* stop when there's nothing left to do */ - THREAD_EXIT_SYNC(); - return stop; -} - /* Runs the polling loop */ static void run_poll_loop() { @@ -2421,10 +2403,9 @@ static void run_poll_loop() /* Check if we can expire some tasks */ next = wake_expired_tasks(); - /* the first thread requests a synchronization to exit when - * there is no active jobs anymore */ - if (tid == 0 && jobs == 0) - THREAD_WANT_SYNC(); + /* stop when there's nothing left to do */ + if (jobs == 0) + break; /* expire immediately if events are pending */ exp = now_ms; @@ -2453,10 +2434,6 @@ static void run_poll_loop() /* check for server status updates */ servers_check_for_updates(); - /* Synchronize all polling loops */ - if (sync_poll_loop()) - break; - activity[tid].loops++; } }