Use PTHREAD_THREADS_MAX if available

Stops us deadlocking on OpenBSD if we need more than 4 threads.

Fixes #6503
This commit is contained in:
Fabian Homborg 2020-01-18 09:06:12 +01:00
parent b62fa53807
commit ca08cc331b

View File

@ -21,11 +21,17 @@
#include "global_safety.h"
#include "wutil.h"
#ifdef PTHREAD_THREADS_MAX
#if PTHREAD_THREADS_MAX < 64
#define IO_MAX_THREADS PTHREAD_THREADS_MAX
#endif
#else
#ifdef _POSIX_THREAD_THREADS_MAX
#if _POSIX_THREAD_THREADS_MAX < 64
#define IO_MAX_THREADS _POSIX_THREAD_THREADS_MAX
#endif
#endif
#endif
#ifndef IO_MAX_THREADS
#define IO_MAX_THREADS 64