]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUILD: kqueue/threads: Add test on MAX_THREADS to avoid warnings when complied withou...
authorChristopher Faulet <cfaulet@haproxy.com>
Thu, 25 Jan 2018 15:40:35 +0000 (16:40 +0100)
committerWilly Tarreau <w@1wt.eu>
Thu, 25 Jan 2018 16:52:57 +0000 (17:52 +0100)
This is the same patch than the previous one ("BUILD: epoll/threads: Add test on
MAX_THREADS to avoid warnings when complied without threads ").

It should be backported in 1.8 with the commit 7a2364d4 ("BUG/MEDIUM:
kqueue/threads: use one kqueue_fd per thread").

src/ev_kqueue.c

index d58bc4ab4e848c8875b50e1b92752452fce7fe55..86731af88be4c914a1ad0dda4e9aa9fccd65db28 100644 (file)
@@ -161,7 +161,7 @@ static int init_kqueue_per_thread()
        if (kev == NULL)
                goto fail_alloc;
 
-       if (tid) {
+       if (MAX_THREADS > 1 && tid) {
                kqueue_fd[tid] = kqueue();
                if (kqueue_fd[tid] < 0)
                        goto fail_fd;
@@ -184,7 +184,7 @@ static int init_kqueue_per_thread()
 
 static void deinit_kqueue_per_thread()
 {
-       if (tid)
+       if (MAX_THREADS > 1 && tid)
                close(kqueue_fd[tid]);
 
        free(kev);