Ensure max number of open file handles is 1024 on windows as well

It is 512 by default.
This commit is contained in:
Kovid Goyal 2015-06-21 08:49:19 +05:30
parent 5c359f09c0
commit fd5c130731

View File

@ -62,7 +62,14 @@ if not _run_once:
# #
# Ensure that the max number of open files is at least 1024 # Ensure that the max number of open files is at least 1024
if not iswindows: if iswindows:
# See https://msdn.microsoft.com/en-us/library/6e3b887c.aspx
import ctypes
msvcrt = ctypes.cdll.msvcrt
soft, hard = msvcrt._getmaxstdio(), 2048
if soft < 1024:
msvcrt._setmaxstdio(min(1024, hard))
else:
import resource import resource
soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE) soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
if soft < 1024: if soft < 1024: