Just hardcode a thread limit of 1024

64 is too low (it's actually reachable), and every sensible system should have a limit above
this.

On OpenBSD and FreeBSD it's ULONG_MAX, on my linux system it's 61990.

Plus we currently fail by hanging if our limit is reached, so this
should improve things regardless.

On my linux system _POSIX_THREAD_THREADS_MAX works out to 64 here,
which is just too low, even tho the system can handle more.

Fixes #6503 harder.
This commit is contained in:
Fabian Homborg 2020-01-18 09:26:59 +01:00
parent ca08cc331b
commit 018e51c935

View file

@ -21,21 +21,11 @@
#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
#endif
// We just define a thread limit of 1024.
// On all systems I've seen the limit is higher,
// but on some (like linux with glibc) the setting for _POSIX_THREAD_THREADS_MAX is 64,
// which is too low, even tho the system can handle more than 64 threads.
#define IO_MAX_THREADS 1024
// Values for the wakeup bytes sent to the ioport.
#define IO_SERVICE_MAIN_THREAD_REQUEST_QUEUE 99