diff --git a/patches/ntdll-Vista_Threadpool/0002-ntdll-Implement-TpSetPool-Min-Max-Threads.patch b/patches/ntdll-Vista_Threadpool/0002-ntdll-Implement-TpSetPool-Min-Max-Threads.patch index b1ca490e..cc4d0b34 100644 --- a/patches/ntdll-Vista_Threadpool/0002-ntdll-Implement-TpSetPool-Min-Max-Threads.patch +++ b/patches/ntdll-Vista_Threadpool/0002-ntdll-Implement-TpSetPool-Min-Max-Threads.patch @@ -1,12 +1,12 @@ -From 13635df17569be46833f21980ba22f2b4db85102 Mon Sep 17 00:00:00 2001 +From 0fe9a4e96bdb45ca76e7abf0b73a69d24e1a3ce2 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Wed, 4 Mar 2015 00:16:20 +0100 -Subject: ntdll: Implement TpSetPool[Min|Max]Threads. +Subject: ntdll: Implement TpSetPool[Min|Max]Threads. (v2) --- dlls/ntdll/ntdll.spec | 2 ++ - dlls/ntdll/threadpool.c | 33 +++++++++++++++++++++++++++++++++ - 2 files changed, 35 insertions(+) + dlls/ntdll/threadpool.c | 35 +++++++++++++++++++++++++++++++++++ + 2 files changed, 37 insertions(+) diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index d9aafdd..88d915b 100644 @@ -22,10 +22,10 @@ index d9aafdd..88d915b 100644 @ stdcall -ret64 VerSetConditionMask(int64 long long) @ stdcall ZwAcceptConnectPort(ptr long ptr long long ptr) NtAcceptConnectPort diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c -index df92ef2..16d9209 100644 +index cc5f8e9..cb2dcdd 100644 --- a/dlls/ntdll/threadpool.c +++ b/dlls/ntdll/threadpool.c -@@ -1380,6 +1380,39 @@ VOID WINAPI TpReleasePool( TP_POOL *pool ) +@@ -1387,6 +1387,41 @@ VOID WINAPI TpReleasePool( TP_POOL *pool ) } /*********************************************************************** @@ -39,7 +39,8 @@ index df92ef2..16d9209 100644 + if (this) + { + RtlEnterCriticalSection( &this->cs ); -+ this->max_workers = max(maximum, 1); ++ this->max_workers = max( maximum, 1 ); ++ this->min_workers = min( this->min_workers, this->max_workers ); + RtlLeaveCriticalSection( &this->cs ); + } +} @@ -55,7 +56,8 @@ index df92ef2..16d9209 100644 + if (this) + { + RtlEnterCriticalSection( &this->cs ); -+ this->min_workers = max(minimum, 1); ++ this->min_workers = max( minimum, 1 ); ++ this->max_workers = max( this->min_workers, this->max_workers ); + RtlLeaveCriticalSection( &this->cs ); + } + return TRUE; diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 38679d53..c6a33259 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -3284,7 +3284,7 @@ if test "$enable_ntdll_Vista_Threadpool" -eq 1; then patch_apply ntdll-Vista_Threadpool/0020-kernel32-Forward-threadpool-wait-functions-to-ntdll.patch ( echo '+ { "Sebastian Lackner", "ntdll: Implement TpSimpleTryPost and basic threadpool infrastructure.", 1 },'; - echo '+ { "Sebastian Lackner", "ntdll: Implement TpSetPool[Min|Max]Threads.", 1 },'; + echo '+ { "Sebastian Lackner", "ntdll: Implement TpSetPool[Min|Max]Threads.", 2 },'; echo '+ { "Sebastian Lackner", "ntdll: Implement threadpool cleanup group functions.", 1 },'; echo '+ { "Sebastian Lackner", "ntdll/tests: Add tests for TpAllocCleanupGroup and related functions.", 1 },'; echo '+ { "Sebastian Lackner", "ntdll: Implement threadpool work item functions.", 1 },';