ntdll: Use a pthread mutex for the wait on address section.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
85db4f7ec2
commit
052e8dbf59
|
@ -590,7 +590,7 @@ static void invoke_system_apc( const apc_call_t *call, apc_result_t *result )
|
||||||
* server_select
|
* server_select
|
||||||
*/
|
*/
|
||||||
unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT flags,
|
unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT flags,
|
||||||
timeout_t abs_timeout, CONTEXT *context, RTL_CRITICAL_SECTION *cs,
|
timeout_t abs_timeout, CONTEXT *context, pthread_mutex_t *mutex,
|
||||||
user_apc_t *user_apc )
|
user_apc_t *user_apc )
|
||||||
{
|
{
|
||||||
unsigned int ret;
|
unsigned int ret;
|
||||||
|
@ -649,10 +649,10 @@ unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT
|
||||||
size = offsetof( select_op_t, signal_and_wait.signal );
|
size = offsetof( select_op_t, signal_and_wait.signal );
|
||||||
}
|
}
|
||||||
pthread_sigmask( SIG_SETMASK, &old_set, NULL );
|
pthread_sigmask( SIG_SETMASK, &old_set, NULL );
|
||||||
if (cs)
|
if (mutex)
|
||||||
{
|
{
|
||||||
RtlLeaveCriticalSection( cs );
|
pthread_mutex_unlock( mutex );
|
||||||
cs = NULL;
|
mutex = NULL;
|
||||||
}
|
}
|
||||||
if (ret != STATUS_PENDING) break;
|
if (ret != STATUS_PENDING) break;
|
||||||
|
|
||||||
|
|
|
@ -78,15 +78,7 @@ HANDLE keyed_event = 0;
|
||||||
|
|
||||||
static const LARGE_INTEGER zero_timeout;
|
static const LARGE_INTEGER zero_timeout;
|
||||||
|
|
||||||
static RTL_CRITICAL_SECTION addr_section;
|
static pthread_mutex_t addr_mutex = PTHREAD_MUTEX_INITIALIZER;
|
||||||
static RTL_CRITICAL_SECTION_DEBUG addr_section_debug =
|
|
||||||
{
|
|
||||||
0, 0, &addr_section,
|
|
||||||
{ &addr_section_debug.ProcessLocksList, &addr_section_debug.ProcessLocksList },
|
|
||||||
0, 0, { (DWORD_PTR)(__FILE__ ": addr_section") }
|
|
||||||
};
|
|
||||||
static RTL_CRITICAL_SECTION addr_section = { &addr_section_debug, -1, 0, 0, 0, 0 };
|
|
||||||
|
|
||||||
|
|
||||||
/* return a monotonic time counter, in Win32 ticks */
|
/* return a monotonic time counter, in Win32 ticks */
|
||||||
static inline ULONGLONG monotonic_counter(void)
|
static inline ULONGLONG monotonic_counter(void)
|
||||||
|
@ -2253,10 +2245,10 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
|
||||||
if ((ret = fast_wait_addr( addr, cmp, size, timeout )) != STATUS_NOT_IMPLEMENTED)
|
if ((ret = fast_wait_addr( addr, cmp, size, timeout )) != STATUS_NOT_IMPLEMENTED)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
RtlEnterCriticalSection( &addr_section );
|
pthread_mutex_lock( &addr_mutex );
|
||||||
if (!compare_addr( addr, cmp, size ))
|
if (!compare_addr( addr, cmp, size ))
|
||||||
{
|
{
|
||||||
RtlLeaveCriticalSection( &addr_section );
|
pthread_mutex_unlock( &addr_mutex );
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2272,7 +2264,8 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
|
||||||
select_op.keyed_event.handle = wine_server_obj_handle( keyed_event );
|
select_op.keyed_event.handle = wine_server_obj_handle( keyed_event );
|
||||||
select_op.keyed_event.key = wine_server_client_ptr( addr );
|
select_op.keyed_event.key = wine_server_client_ptr( addr );
|
||||||
|
|
||||||
return server_select( &select_op, sizeof(select_op.keyed_event), SELECT_INTERRUPTIBLE, abs_timeout, NULL, &addr_section, NULL );
|
return server_select( &select_op, sizeof(select_op.keyed_event), SELECT_INTERRUPTIBLE,
|
||||||
|
abs_timeout, NULL, &addr_mutex, NULL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -2282,9 +2275,9 @@ void WINAPI RtlWakeAddressAll( const void *addr )
|
||||||
{
|
{
|
||||||
if (fast_wake_addr( addr ) != STATUS_NOT_IMPLEMENTED) return;
|
if (fast_wake_addr( addr ) != STATUS_NOT_IMPLEMENTED) return;
|
||||||
|
|
||||||
RtlEnterCriticalSection( &addr_section );
|
pthread_mutex_lock( &addr_mutex );
|
||||||
while (NtReleaseKeyedEvent( 0, addr, 0, &zero_timeout ) == STATUS_SUCCESS) {}
|
while (NtReleaseKeyedEvent( 0, addr, 0, &zero_timeout ) == STATUS_SUCCESS) {}
|
||||||
RtlLeaveCriticalSection( &addr_section );
|
pthread_mutex_unlock( &addr_mutex );
|
||||||
}
|
}
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
|
@ -2294,7 +2287,7 @@ void WINAPI RtlWakeAddressSingle( const void *addr )
|
||||||
{
|
{
|
||||||
if (fast_wake_addr( addr ) != STATUS_NOT_IMPLEMENTED) return;
|
if (fast_wake_addr( addr ) != STATUS_NOT_IMPLEMENTED) return;
|
||||||
|
|
||||||
RtlEnterCriticalSection( &addr_section );
|
pthread_mutex_lock( &addr_mutex );
|
||||||
NtReleaseKeyedEvent( 0, addr, 0, &zero_timeout );
|
NtReleaseKeyedEvent( 0, addr, 0, &zero_timeout );
|
||||||
RtlLeaveCriticalSection( &addr_section );
|
pthread_mutex_unlock( &addr_mutex );
|
||||||
}
|
}
|
||||||
|
|
|
@ -162,7 +162,7 @@ extern unsigned int server_call_unlocked( void *req_ptr ) DECLSPEC_HIDDEN;
|
||||||
extern void server_enter_uninterrupted_section( pthread_mutex_t *mutex, sigset_t *sigset ) DECLSPEC_HIDDEN;
|
extern void server_enter_uninterrupted_section( pthread_mutex_t *mutex, sigset_t *sigset ) DECLSPEC_HIDDEN;
|
||||||
extern void server_leave_uninterrupted_section( pthread_mutex_t *mutex, sigset_t *sigset ) DECLSPEC_HIDDEN;
|
extern void server_leave_uninterrupted_section( pthread_mutex_t *mutex, sigset_t *sigset ) DECLSPEC_HIDDEN;
|
||||||
extern unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT flags,
|
extern unsigned int server_select( const select_op_t *select_op, data_size_t size, UINT flags,
|
||||||
timeout_t abs_timeout, CONTEXT *context, RTL_CRITICAL_SECTION *cs,
|
timeout_t abs_timeout, CONTEXT *context, pthread_mutex_t *mutex,
|
||||||
user_apc_t *user_apc ) DECLSPEC_HIDDEN;
|
user_apc_t *user_apc ) DECLSPEC_HIDDEN;
|
||||||
extern unsigned int server_wait( const select_op_t *select_op, data_size_t size, UINT flags,
|
extern unsigned int server_wait( const select_op_t *select_op, data_size_t size, UINT flags,
|
||||||
const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN;
|
const LARGE_INTEGER *timeout ) DECLSPEC_HIDDEN;
|
||||||
|
|
Loading…
Reference in New Issue