call _setmaxstdio() on win32

Windows has a limit of 512 files open at once for the fopen()
family of functions, and 2048 for the _open() family.

Call _setmaxstdio() in vips_init() to try to raise the stdio level to
match _open().

See https://github.com/jcupitt/libvips/issues/527
This commit is contained in:
John Cupitt 2016-09-18 12:46:19 +01:00
parent c88fa5ac73
commit 74089aa2e4
1 changed files with 12 additions and 0 deletions

View File

@ -24,6 +24,8 @@
* 14/3/10
* - init image and region before we start, we need all types to be fully
* constructed before we go parallel
* 18/9/16
* - call _setmaxstdio() on win32
*/
/*
@ -277,6 +279,16 @@ vips_init( const char *argv0 )
return( 0 );
started = TRUE;
#ifdef OS_WIN32
/* Windows has a limit of 512 files open at once for the fopen() family
* of functions, and 2048 for the _open() family. This raises the limit
* of fopen() to the same level as _open().
*
* It will not go any higher than this, unfortunately.
*/
(void) _setmaxstdio( 2048 );
#endif /*OS_WIN32*/
#ifdef HAVE_TYPE_INIT
/* Before glib 2.36 you have to call this on startup.
*/