mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Ensure max number of open file handles is 1024 on windows as well
It is 512 by default.
This commit is contained in:
parent
5c359f09c0
commit
fd5c130731
@ -62,7 +62,14 @@ if not _run_once:
|
||||
|
||||
#
|
||||
# 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
|
||||
soft, hard = resource.getrlimit(resource.RLIMIT_NOFILE)
|
||||
if soft < 1024:
|
||||
|
Loading…
x
Reference in New Issue
Block a user