Rebase against 2a4ec7dafc7ee38108f6a9f626a7c39e6b6777e0.

This commit is contained in:
Alistair Leslie-Hughes 2022-09-27 10:29:23 +10:00
parent fe476e7241
commit 21009111bd
3 changed files with 47 additions and 47 deletions

View File

@ -1,4 +1,4 @@
From 217794090443a96e712ffe3970e4a70ded2277dc Mon Sep 17 00:00:00 2001
From 27019592a4f4aa7134f605093b5d83fe3764dcf5 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sat, 5 Aug 2017 03:39:37 +0200
Subject: [PATCH] ntdll: Use fast CS functions for threadpool locking.
@ -8,19 +8,19 @@ Subject: [PATCH] ntdll: Use fast CS functions for threadpool locking.
1 file changed, 45 insertions(+), 45 deletions(-)
diff --git a/dlls/ntdll/threadpool.c b/dlls/ntdll/threadpool.c
index ca323919d05..581d503b6a4 100644
index 421d1ade133..71771dd2987 100644
--- a/dlls/ntdll/threadpool.c
+++ b/dlls/ntdll/threadpool.c
@@ -1053,7 +1053,7 @@ static void CALLBACK timerqueue_thread_proc( void *param )
@@ -1063,7 +1063,7 @@ static void CALLBACK timerqueue_thread_proc( void *param )
TRACE( "starting timer queue thread\n" );
set_thread_name(L"wine_threadpool_timerqueue");
- RtlEnterCriticalSection( &timerqueue.cs );
+ enter_critical_section( &timerqueue.cs );
for (;;)
{
NtQuerySystemTime( &now );
@@ -1126,7 +1126,7 @@ static void CALLBACK timerqueue_thread_proc( void *param )
@@ -1136,7 +1136,7 @@ static void CALLBACK timerqueue_thread_proc( void *param )
}
timerqueue.thread_running = FALSE;
@ -29,7 +29,7 @@ index ca323919d05..581d503b6a4 100644
TRACE( "terminating timer queue thread\n" );
RtlExitUserThread( 0 );
@@ -1171,7 +1171,7 @@ static NTSTATUS tp_timerqueue_lock( struct threadpool_object *timer )
@@ -1181,7 +1181,7 @@ static NTSTATUS tp_timerqueue_lock( struct threadpool_object *timer )
timer->u.timer.period = 0;
timer->u.timer.window_length = 0;
@ -38,7 +38,7 @@ index ca323919d05..581d503b6a4 100644
/* Make sure that the timerqueue thread is running. */
if (!timerqueue.thread_running)
@@ -1192,7 +1192,7 @@ static NTSTATUS tp_timerqueue_lock( struct threadpool_object *timer )
@@ -1202,7 +1202,7 @@ static NTSTATUS tp_timerqueue_lock( struct threadpool_object *timer )
timerqueue.objcount++;
}
@ -47,7 +47,7 @@ index ca323919d05..581d503b6a4 100644
return status;
}
@@ -1205,7 +1205,7 @@ static void tp_timerqueue_unlock( struct threadpool_object *timer )
@@ -1215,7 +1215,7 @@ static void tp_timerqueue_unlock( struct threadpool_object *timer )
{
assert( timer->type == TP_OBJECT_TYPE_TIMER );
@ -56,7 +56,7 @@ index ca323919d05..581d503b6a4 100644
if (timer->u.timer.timer_initialized)
{
/* If timer was pending, remove it. */
@@ -1224,7 +1224,7 @@ static void tp_timerqueue_unlock( struct threadpool_object *timer )
@@ -1234,7 +1234,7 @@ static void tp_timerqueue_unlock( struct threadpool_object *timer )
timer->u.timer.timer_initialized = FALSE;
}
@ -65,16 +65,16 @@ index ca323919d05..581d503b6a4 100644
}
/***********************************************************************
@@ -1242,7 +1242,7 @@ static void CALLBACK waitqueue_thread_proc( void *param )
@@ -1253,7 +1253,7 @@ static void CALLBACK waitqueue_thread_proc( void *param )
TRACE( "starting wait queue thread\n" );
set_thread_name(L"wine_threadpool_waitqueue");
- RtlEnterCriticalSection( &waitqueue.cs );
+ enter_critical_section( &waitqueue.cs );
for (;;)
{
@@ -1291,10 +1291,10 @@ static void CALLBACK waitqueue_thread_proc( void *param )
@@ -1302,10 +1302,10 @@ static void CALLBACK waitqueue_thread_proc( void *param )
/* All wait objects have been destroyed, if no new wait objects are created
* within some amount of time, then we can shutdown this thread. */
assert( num_handles == 0 );
@ -87,7 +87,7 @@ index ca323919d05..581d503b6a4 100644
if (status == STATUS_TIMEOUT && !bucket->objcount)
break;
@@ -1304,7 +1304,7 @@ static void CALLBACK waitqueue_thread_proc( void *param )
@@ -1315,7 +1315,7 @@ static void CALLBACK waitqueue_thread_proc( void *param )
handles[num_handles] = bucket->update_event;
RtlLeaveCriticalSection( &waitqueue.cs );
status = NtWaitForMultipleObjects( num_handles + 1, handles, TRUE, bucket->alertable, &timeout );
@ -96,7 +96,7 @@ index ca323919d05..581d503b6a4 100644
if (status >= STATUS_WAIT_0 && status < STATUS_WAIT_0 + num_handles)
{
@@ -1388,7 +1388,7 @@ static void CALLBACK waitqueue_thread_proc( void *param )
@@ -1399,7 +1399,7 @@ static void CALLBACK waitqueue_thread_proc( void *param )
if (!--waitqueue.num_buckets)
assert( list_empty( &waitqueue.buckets ) );
@ -105,7 +105,7 @@ index ca323919d05..581d503b6a4 100644
TRACE( "terminating wait queue thread\n" );
@@ -1418,7 +1418,7 @@ static NTSTATUS tp_waitqueue_lock( struct threadpool_object *wait )
@@ -1429,7 +1429,7 @@ static NTSTATUS tp_waitqueue_lock( struct threadpool_object *wait )
wait->u.wait.timeout = 0;
wait->u.wait.handle = INVALID_HANDLE_VALUE;
@ -114,7 +114,7 @@ index ca323919d05..581d503b6a4 100644
/* Try to assign to existing bucket if possible. */
LIST_FOR_EACH_ENTRY( bucket, &waitqueue.buckets, struct waitqueue_bucket, bucket_entry )
@@ -1475,7 +1475,7 @@ static NTSTATUS tp_waitqueue_lock( struct threadpool_object *wait )
@@ -1486,7 +1486,7 @@ static NTSTATUS tp_waitqueue_lock( struct threadpool_object *wait )
}
out:
@ -123,7 +123,7 @@ index ca323919d05..581d503b6a4 100644
return status;
}
@@ -1486,7 +1486,7 @@ static void tp_waitqueue_unlock( struct threadpool_object *wait )
@@ -1497,7 +1497,7 @@ static void tp_waitqueue_unlock( struct threadpool_object *wait )
{
assert( wait->type == TP_OBJECT_TYPE_WAIT );
@ -132,7 +132,7 @@ index ca323919d05..581d503b6a4 100644
if (wait->u.wait.bucket)
{
struct waitqueue_bucket *bucket = wait->u.wait.bucket;
@@ -1498,7 +1498,7 @@ static void tp_waitqueue_unlock( struct threadpool_object *wait )
@@ -1509,7 +1509,7 @@ static void tp_waitqueue_unlock( struct threadpool_object *wait )
NtSetEvent( bucket->update_event, NULL );
}
@ -141,7 +141,7 @@ index ca323919d05..581d503b6a4 100644
}
static void CALLBACK ioqueue_thread_proc( void *param )
@@ -1775,7 +1775,7 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
@@ -1787,7 +1787,7 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
pool = default_threadpool;
}
@ -150,7 +150,7 @@ index ca323919d05..581d503b6a4 100644
/* Make sure that the threadpool has at least one thread. */
if (!pool->num_workers)
@@ -1789,7 +1789,7 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
@@ -1801,7 +1801,7 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
pool->objcount++;
}
@ -159,7 +159,7 @@ index ca323919d05..581d503b6a4 100644
if (status != STATUS_SUCCESS)
return status;
@@ -1805,9 +1805,9 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
@@ -1817,9 +1817,9 @@ static NTSTATUS tp_threadpool_lock( struct threadpool **out, TP_CALLBACK_ENVIRON
*/
static void tp_threadpool_unlock( struct threadpool *pool )
{
@ -171,7 +171,7 @@ index ca323919d05..581d503b6a4 100644
tp_threadpool_release( pool );
}
@@ -1945,10 +1945,10 @@ static void tp_object_initialize( struct threadpool_object *object, struct threa
@@ -1957,10 +1957,10 @@ static void tp_object_initialize( struct threadpool_object *object, struct threa
struct threadpool_group *group = object->group;
InterlockedIncrement( &group->refcount );
@ -184,7 +184,7 @@ index ca323919d05..581d503b6a4 100644
}
if (is_simple_callback)
@@ -1975,7 +1975,7 @@ static void tp_object_submit( struct threadpool_object *object, BOOL signaled )
@@ -1987,7 +1987,7 @@ static void tp_object_submit( struct threadpool_object *object, BOOL signaled )
assert( !object->shutdown );
assert( !pool->shutdown );
@ -193,7 +193,7 @@ index ca323919d05..581d503b6a4 100644
/* Start new worker threads if required. */
if (pool->num_busy_workers >= pool->num_workers &&
@@ -1998,7 +1998,7 @@ static void tp_object_submit( struct threadpool_object *object, BOOL signaled )
@@ -2010,7 +2010,7 @@ static void tp_object_submit( struct threadpool_object *object, BOOL signaled )
RtlWakeConditionVariable( &pool->update_event );
}
@ -202,7 +202,7 @@ index ca323919d05..581d503b6a4 100644
}
/***********************************************************************
@@ -2011,7 +2011,7 @@ static void tp_object_cancel( struct threadpool_object *object )
@@ -2023,7 +2023,7 @@ static void tp_object_cancel( struct threadpool_object *object )
struct threadpool *pool = object->pool;
LONG pending_callbacks = 0;
@ -211,7 +211,7 @@ index ca323919d05..581d503b6a4 100644
if (object->num_pending_callbacks)
{
pending_callbacks = object->num_pending_callbacks;
@@ -2026,7 +2026,7 @@ static void tp_object_cancel( struct threadpool_object *object )
@@ -2038,7 +2038,7 @@ static void tp_object_cancel( struct threadpool_object *object )
object->u.io.skipped_count += object->u.io.pending_count;
object->u.io.pending_count = 0;
}
@ -220,7 +220,7 @@ index ca323919d05..581d503b6a4 100644
while (pending_callbacks--)
tp_object_release( object );
@@ -2055,7 +2055,7 @@ static void tp_object_wait( struct threadpool_object *object, BOOL group_wait )
@@ -2067,7 +2067,7 @@ static void tp_object_wait( struct threadpool_object *object, BOOL group_wait )
{
struct threadpool *pool = object->pool;
@ -229,7 +229,7 @@ index ca323919d05..581d503b6a4 100644
while (!object_is_finished( object, group_wait ))
{
if (group_wait)
@@ -2063,7 +2063,7 @@ static void tp_object_wait( struct threadpool_object *object, BOOL group_wait )
@@ -2075,7 +2075,7 @@ static void tp_object_wait( struct threadpool_object *object, BOOL group_wait )
else
RtlSleepConditionVariableCS( &object->finished_event, &pool->cs, NULL );
}
@ -238,7 +238,7 @@ index ca323919d05..581d503b6a4 100644
}
static void tp_ioqueue_unlock( struct threadpool_object *io )
@@ -2117,13 +2117,13 @@ static BOOL tp_object_release( struct threadpool_object *object )
@@ -2129,13 +2129,13 @@ static BOOL tp_object_release( struct threadpool_object *object )
{
struct threadpool_group *group = object->group;
@ -254,16 +254,16 @@ index ca323919d05..581d503b6a4 100644
tp_group_release( group );
}
@@ -2324,7 +2324,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
@@ -2337,7 +2337,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
TRACE( "starting worker thread for pool %p\n", pool );
set_thread_name(L"wine_threadpool_worker");
- RtlEnterCriticalSection( &pool->cs );
+ enter_critical_section( &pool->cs );
for (;;)
{
while ((ptr = threadpool_get_next_item( pool )))
@@ -2364,7 +2364,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
@@ -2377,7 +2377,7 @@ static void CALLBACK threadpool_worker_proc( void *param )
}
}
pool->num_workers--;
@ -272,7 +272,7 @@ index ca323919d05..581d503b6a4 100644
TRACE( "terminating worker thread for pool %p\n", pool );
tp_threadpool_release( pool );
@@ -2612,7 +2612,7 @@ NTSTATUS WINAPI TpCallbackMayRunLong( TP_CALLBACK_INSTANCE *instance )
@@ -2625,7 +2625,7 @@ NTSTATUS WINAPI TpCallbackMayRunLong( TP_CALLBACK_INSTANCE *instance )
return STATUS_SUCCESS;
pool = object->pool;
@ -281,7 +281,7 @@ index ca323919d05..581d503b6a4 100644
/* Start new worker threads if required. */
if (pool->num_busy_workers >= pool->num_workers)
@@ -2627,7 +2627,7 @@ NTSTATUS WINAPI TpCallbackMayRunLong( TP_CALLBACK_INSTANCE *instance )
@@ -2640,7 +2640,7 @@ NTSTATUS WINAPI TpCallbackMayRunLong( TP_CALLBACK_INSTANCE *instance )
}
}
@ -290,7 +290,7 @@ index ca323919d05..581d503b6a4 100644
this->may_run_long = TRUE;
return status;
}
@@ -2708,13 +2708,13 @@ VOID WINAPI TpDisassociateCallback( TP_CALLBACK_INSTANCE *instance )
@@ -2721,13 +2721,13 @@ VOID WINAPI TpDisassociateCallback( TP_CALLBACK_INSTANCE *instance )
return;
pool = object->pool;
@ -306,7 +306,7 @@ index ca323919d05..581d503b6a4 100644
this->associated = FALSE;
}
@@ -2766,7 +2766,7 @@ VOID WINAPI TpReleaseCleanupGroupMembers( TP_CLEANUP_GROUP *group, BOOL cancel_p
@@ -2779,7 +2779,7 @@ VOID WINAPI TpReleaseCleanupGroupMembers( TP_CLEANUP_GROUP *group, BOOL cancel_p
TRACE( "%p %u %p\n", group, cancel_pending, userdata );
@ -315,7 +315,7 @@ index ca323919d05..581d503b6a4 100644
/* Unset group, increase references, and mark objects for shutdown */
LIST_FOR_EACH_ENTRY_SAFE( object, next, &this->members, struct threadpool_object, group_entry )
@@ -2792,7 +2792,7 @@ VOID WINAPI TpReleaseCleanupGroupMembers( TP_CLEANUP_GROUP *group, BOOL cancel_p
@@ -2805,7 +2805,7 @@ VOID WINAPI TpReleaseCleanupGroupMembers( TP_CLEANUP_GROUP *group, BOOL cancel_p
list_init( &members );
list_move_tail( &members, &this->members );
@ -324,7 +324,7 @@ index ca323919d05..581d503b6a4 100644
/* Cancel pending callbacks if requested */
if (cancel_pending)
@@ -2915,10 +2915,10 @@ VOID WINAPI TpSetPoolMaxThreads( TP_POOL *pool, DWORD maximum )
@@ -2928,10 +2928,10 @@ VOID WINAPI TpSetPoolMaxThreads( TP_POOL *pool, DWORD maximum )
TRACE( "%p %u\n", pool, maximum );
@ -337,7 +337,7 @@ index ca323919d05..581d503b6a4 100644
}
/***********************************************************************
@@ -2931,7 +2931,7 @@ BOOL WINAPI TpSetPoolMinThreads( TP_POOL *pool, DWORD minimum )
@@ -2944,7 +2944,7 @@ BOOL WINAPI TpSetPoolMinThreads( TP_POOL *pool, DWORD minimum )
TRACE( "%p %u\n", pool, minimum );
@ -346,7 +346,7 @@ index ca323919d05..581d503b6a4 100644
while (this->num_workers < minimum)
{
@@ -2946,7 +2946,7 @@ BOOL WINAPI TpSetPoolMinThreads( TP_POOL *pool, DWORD minimum )
@@ -2959,7 +2959,7 @@ BOOL WINAPI TpSetPoolMinThreads( TP_POOL *pool, DWORD minimum )
this->max_workers = max( this->min_workers, this->max_workers );
}
@ -355,7 +355,7 @@ index ca323919d05..581d503b6a4 100644
return !status;
}
@@ -2962,7 +2962,7 @@ VOID WINAPI TpSetTimer( TP_TIMER *timer, LARGE_INTEGER *timeout, LONG period, LO
@@ -2975,7 +2975,7 @@ VOID WINAPI TpSetTimer( TP_TIMER *timer, LARGE_INTEGER *timeout, LONG period, LO
TRACE( "%p %p %u %u\n", timer, timeout, period, window_length );
@ -364,7 +364,7 @@ index ca323919d05..581d503b6a4 100644
assert( this->u.timer.timer_initialized );
this->u.timer.timer_set = timeout != NULL;
@@ -3022,7 +3022,7 @@ VOID WINAPI TpSetTimer( TP_TIMER *timer, LARGE_INTEGER *timeout, LONG period, LO
@@ -3035,7 +3035,7 @@ VOID WINAPI TpSetTimer( TP_TIMER *timer, LARGE_INTEGER *timeout, LONG period, LO
this->u.timer.timer_pending = TRUE;
}
@ -373,7 +373,7 @@ index ca323919d05..581d503b6a4 100644
if (submit_timer)
tp_object_submit( this, FALSE );
@@ -3038,7 +3038,7 @@ VOID WINAPI TpSetWait( TP_WAIT *wait, HANDLE handle, LARGE_INTEGER *timeout )
@@ -3051,7 +3051,7 @@ VOID WINAPI TpSetWait( TP_WAIT *wait, HANDLE handle, LARGE_INTEGER *timeout )
TRACE( "%p %p %p\n", wait, handle, timeout );
@ -382,7 +382,7 @@ index ca323919d05..581d503b6a4 100644
assert( this->u.wait.bucket );
this->u.wait.handle = handle;
@@ -3077,7 +3077,7 @@ VOID WINAPI TpSetWait( TP_WAIT *wait, HANDLE handle, LARGE_INTEGER *timeout )
@@ -3090,7 +3090,7 @@ VOID WINAPI TpSetWait( TP_WAIT *wait, HANDLE handle, LARGE_INTEGER *timeout )
NtSetEvent( bucket->update_event, NULL );
}
@ -392,5 +392,5 @@ index ca323919d05..581d503b6a4 100644
/***********************************************************************
--
2.30.2
2.37.2

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "ad26f04f69a03c6299cd2d0f14fb03b2df2c1495"
echo "2a4ec7dafc7ee38108f6a9f626a7c39e6b6777e0"
}
# Show version information

View File

@ -1 +1 @@
ad26f04f69a03c6299cd2d0f14fb03b2df2c1495
2a4ec7dafc7ee38108f6a9f626a7c39e6b6777e0