diff options
| author | Garrett D'Amore <garrett@damore.org> | 2023-12-29 19:09:24 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2023-12-29 19:09:24 -0800 |
| commit | d0e30d8d70931ff0ba2d936ba35996e2f4e62ee5 (patch) | |
| tree | 4a7d32a0c713926967bb23339a760d91adc814f3 /src/platform | |
| parent | 3298ac1e93742e7a1ef5c4dc2e9b603dfa89d3cb (diff) | |
| download | nng-d0e30d8d70931ff0ba2d936ba35996e2f4e62ee5.tar.gz nng-d0e30d8d70931ff0ba2d936ba35996e2f4e62ee5.tar.bz2 nng-d0e30d8d70931ff0ba2d936ba35996e2f4e62ee5.zip | |
provide NNG_MAX_POLLER_THREADS
This (defaults to 8) sets a limit on the number of poller threads
that will be used for servicing I/Os. This is the size of the
I/O completion port thread pool on Windows. POSIX pollers are generally
not concurrent at present.
Diffstat (limited to 'src/platform')
| -rw-r--r-- | src/platform/windows/win_io.c | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/src/platform/windows/win_io.c b/src/platform/windows/win_io.c index 489dc01a..b08f2e4d 100644 --- a/src/platform/windows/win_io.c +++ b/src/platform/windows/win_io.c @@ -1,5 +1,5 @@ // -// Copyright 2020 Staysail Systems, Inc. <info@staysail.tech> +// Copyright 2023 Staysail Systems, Inc. <info@staysail.tech> // Copyright 2018 Capitar IT Group BV <info@capitar.com> // // This software is supplied under the terms of the MIT License, a @@ -92,12 +92,17 @@ nni_win_io_sysinit(void) int nthr = nni_plat_ncpu() * 2; // Limits on the thread count. This is fairly arbitrary. - if (nthr < 4) { - nthr = 4; + if (nthr < 2) { + nthr = 2; } - if (nthr > 64) { - nthr = 64; +#ifndef NNG_MAX_POLLER_THREADS +#define NNG_MAX_POLLER_THREADS 8 +#endif +#if NNG_MAX_POLLER_THREADS > 0 + if (nthr > NNG_MAX_POLLER_THREADS) { + nthr = NNG_MAX_POLLER_THREADS; } +#endif if ((win_io_thrs = NNI_ALLOC_STRUCTS(win_io_thrs, nthr)) == NULL) { return (NNG_ENOMEM); } |
