Core: Win32 Thread now reserves smaller stack, AuxThread even smaller than than (1MB, 512KB)

git-svn-id: svn://ultimatepp.org/upp/trunk@10391 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
cxl 2016-11-03 09:05:50 +00:00
parent de1c8b559e
commit 127d7f4b00

View file

@ -146,7 +146,7 @@ bool Thread::Run(Function<void ()> _cb, bool noshutdown)
p->noshutdown = noshutdown;
#ifdef PLATFORM_WIN32
#ifdef CPU_32 // in 32-bit, reduce stack size to 1MB to fit more threads into address space
handle = (HANDLE)_beginthreadex(0, 1024*1024, sThreadRoutine, p, 0, ((unsigned int *)(&thread_id)));
handle = (HANDLE)_beginthreadex(0, 1024*1024, sThreadRoutine, p, STACK_SIZE_PARAM_IS_A_RESERVATION, ((unsigned int *)(&thread_id)));
#else
handle = (HANDLE)_beginthreadex(0, 0, sThreadRoutine, p, 0, ((unsigned int *)(&thread_id)));
#endif
@ -633,7 +633,7 @@ bool StartAuxThread(auxthread_t (auxthread__ *fn)(void *ptr), void *ptr)
{
#ifdef PLATFORM_WIN32
HANDLE handle;
handle = CreateThread(NULL, 0, fn, ptr, 0, NULL);
handle = CreateThread(NULL, 512*1024, fn, ptr, STACK_SIZE_PARAM_IS_A_RESERVATION, NULL);
if(handle) {
CloseHandle(handle);
return true;