Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
a0050be1
Commit
a0050be1
authored
Oct 26, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use the default keyed event when the handle is null.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7c430f5b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
19 deletions
+21
-19
sync.c
dlls/ntdll/sync.c
+19
-17
om.c
dlls/ntdll/tests/om.c
+2
-2
No files found.
dlls/ntdll/sync.c
View file @
a0050be1
...
...
@@ -1189,6 +1189,7 @@ NTSTATUS WINAPI NtWaitForKeyedEvent( HANDLE handle, const void *key,
select_op_t
select_op
;
UINT
flags
=
SELECT_INTERRUPTIBLE
;
if
(
!
handle
)
handle
=
keyed_event
;
if
((
ULONG_PTR
)
key
&
1
)
return
STATUS_INVALID_PARAMETER_1
;
if
(
alertable
)
flags
|=
SELECT_ALERTABLE
;
select_op
.
keyed_event
.
op
=
SELECT_KEYED_EVENT_WAIT
;
...
...
@@ -1206,6 +1207,7 @@ NTSTATUS WINAPI NtReleaseKeyedEvent( HANDLE handle, const void *key,
select_op_t
select_op
;
UINT
flags
=
SELECT_INTERRUPTIBLE
;
if
(
!
handle
)
handle
=
keyed_event
;
if
((
ULONG_PTR
)
key
&
1
)
return
STATUS_INVALID_PARAMETER_1
;
if
(
alertable
)
flags
|=
SELECT_ALERTABLE
;
select_op
.
keyed_event
.
op
=
SELECT_KEYED_EVENT_RELEASE
;
...
...
@@ -1524,7 +1526,7 @@ DWORD WINAPI RtlRunOnceBeginInitialize( RTL_RUN_ONCE *once, ULONG flags, void **
next
=
val
&
~
3
;
if
(
interlocked_cmpxchg_ptr
(
&
once
->
Ptr
,
(
void
*
)((
ULONG_PTR
)
&
next
|
1
),
(
void
*
)
val
)
==
(
void
*
)
val
)
NtWaitForKeyedEvent
(
keyed_event
,
&
next
,
FALSE
,
NULL
);
NtWaitForKeyedEvent
(
0
,
&
next
,
FALSE
,
NULL
);
break
;
case
2
:
/* done */
...
...
@@ -1564,7 +1566,7 @@ DWORD WINAPI RtlRunOnceComplete( RTL_RUN_ONCE *once, ULONG flags, void *context
while
(
val
)
{
ULONG_PTR
next
=
*
(
ULONG_PTR
*
)
val
;
NtReleaseKeyedEvent
(
keyed_event
,
(
void
*
)
val
,
FALSE
,
NULL
);
NtReleaseKeyedEvent
(
0
,
(
void
*
)
val
,
FALSE
,
NULL
);
val
=
next
;
}
return
STATUS_SUCCESS
;
...
...
@@ -1704,12 +1706,12 @@ static inline void srwlock_leave_exclusive( RTL_SRWLOCK *lock, unsigned int val
* exclusive access threads they are processed first, followed by
* the shared waiters. */
if
(
val
&
SRWLOCK_MASK_EXCLUSIVE_QUEUE
)
NtReleaseKeyedEvent
(
keyed_event
,
srwlock_key_exclusive
(
lock
),
FALSE
,
NULL
);
NtReleaseKeyedEvent
(
0
,
srwlock_key_exclusive
(
lock
),
FALSE
,
NULL
);
else
{
val
&=
SRWLOCK_MASK_SHARED_QUEUE
;
/* remove SRWLOCK_MASK_IN_EXCLUSIVE */
while
(
val
--
)
NtReleaseKeyedEvent
(
keyed_event
,
srwlock_key_shared
(
lock
),
FALSE
,
NULL
);
NtReleaseKeyedEvent
(
0
,
srwlock_key_shared
(
lock
),
FALSE
,
NULL
);
}
}
...
...
@@ -1718,7 +1720,7 @@ static inline void srwlock_leave_shared( RTL_SRWLOCK *lock, unsigned int val )
/* Wake up one exclusive thread as soon as the last shared access thread
* has left. */
if
((
val
&
SRWLOCK_MASK_EXCLUSIVE_QUEUE
)
&&
!
(
val
&
SRWLOCK_MASK_SHARED_QUEUE
))
NtReleaseKeyedEvent
(
keyed_event
,
srwlock_key_exclusive
(
lock
),
FALSE
,
NULL
);
NtReleaseKeyedEvent
(
0
,
srwlock_key_exclusive
(
lock
),
FALSE
,
NULL
);
}
/***********************************************************************
...
...
@@ -1747,7 +1749,7 @@ void WINAPI RtlInitializeSRWLock( RTL_SRWLOCK *lock )
void
WINAPI
RtlAcquireSRWLockExclusive
(
RTL_SRWLOCK
*
lock
)
{
if
(
srwlock_lock_exclusive
(
(
unsigned
int
*
)
&
lock
->
Ptr
,
SRWLOCK_RES_EXCLUSIVE
))
NtWaitForKeyedEvent
(
keyed_event
,
srwlock_key_exclusive
(
lock
),
FALSE
,
NULL
);
NtWaitForKeyedEvent
(
0
,
srwlock_key_exclusive
(
lock
),
FALSE
,
NULL
);
}
/***********************************************************************
...
...
@@ -1775,14 +1777,14 @@ void WINAPI RtlAcquireSRWLockShared( RTL_SRWLOCK *lock )
/* Drop exclusive access again and instead requeue for shared access. */
if
((
val
&
SRWLOCK_MASK_EXCLUSIVE_QUEUE
)
&&
!
(
val
&
SRWLOCK_MASK_IN_EXCLUSIVE
))
{
NtWaitForKeyedEvent
(
keyed_event
,
srwlock_key_exclusive
(
lock
),
FALSE
,
NULL
);
NtWaitForKeyedEvent
(
0
,
srwlock_key_exclusive
(
lock
),
FALSE
,
NULL
);
val
=
srwlock_unlock_exclusive
(
(
unsigned
int
*
)
&
lock
->
Ptr
,
(
SRWLOCK_RES_SHARED
-
SRWLOCK_RES_EXCLUSIVE
)
)
-
SRWLOCK_RES_EXCLUSIVE
;
srwlock_leave_exclusive
(
lock
,
val
);
}
if
(
val
&
SRWLOCK_MASK_EXCLUSIVE_QUEUE
)
NtWaitForKeyedEvent
(
keyed_event
,
srwlock_key_shared
(
lock
),
FALSE
,
NULL
);
NtWaitForKeyedEvent
(
0
,
srwlock_key_shared
(
lock
),
FALSE
,
NULL
);
}
/***********************************************************************
...
...
@@ -1866,7 +1868,7 @@ void WINAPI RtlInitializeConditionVariable( RTL_CONDITION_VARIABLE *variable )
void
WINAPI
RtlWakeConditionVariable
(
RTL_CONDITION_VARIABLE
*
variable
)
{
if
(
interlocked_dec_if_nonzero
(
(
int
*
)
&
variable
->
Ptr
))
NtReleaseKeyedEvent
(
keyed_event
,
&
variable
->
Ptr
,
FALSE
,
NULL
);
NtReleaseKeyedEvent
(
0
,
&
variable
->
Ptr
,
FALSE
,
NULL
);
}
/***********************************************************************
...
...
@@ -1878,7 +1880,7 @@ void WINAPI RtlWakeAllConditionVariable( RTL_CONDITION_VARIABLE *variable )
{
int
val
=
interlocked_xchg
(
(
int
*
)
&
variable
->
Ptr
,
0
);
while
(
val
--
>
0
)
NtReleaseKeyedEvent
(
keyed_event
,
&
variable
->
Ptr
,
FALSE
,
NULL
);
NtReleaseKeyedEvent
(
0
,
&
variable
->
Ptr
,
FALSE
,
NULL
);
}
/***********************************************************************
...
...
@@ -1903,11 +1905,11 @@ NTSTATUS WINAPI RtlSleepConditionVariableCS( RTL_CONDITION_VARIABLE *variable, R
interlocked_xchg_add
(
(
int
*
)
&
variable
->
Ptr
,
1
);
RtlLeaveCriticalSection
(
crit
);
status
=
NtWaitForKeyedEvent
(
keyed_event
,
&
variable
->
Ptr
,
FALSE
,
timeout
);
status
=
NtWaitForKeyedEvent
(
0
,
&
variable
->
Ptr
,
FALSE
,
timeout
);
if
(
status
!=
STATUS_SUCCESS
)
{
if
(
!
interlocked_dec_if_nonzero
(
(
int
*
)
&
variable
->
Ptr
))
status
=
NtWaitForKeyedEvent
(
keyed_event
,
&
variable
->
Ptr
,
FALSE
,
NULL
);
status
=
NtWaitForKeyedEvent
(
0
,
&
variable
->
Ptr
,
FALSE
,
NULL
);
}
RtlEnterCriticalSection
(
crit
);
...
...
@@ -1944,11 +1946,11 @@ NTSTATUS WINAPI RtlSleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable,
else
RtlReleaseSRWLockExclusive
(
lock
);
status
=
NtWaitForKeyedEvent
(
keyed_event
,
&
variable
->
Ptr
,
FALSE
,
timeout
);
status
=
NtWaitForKeyedEvent
(
0
,
&
variable
->
Ptr
,
FALSE
,
timeout
);
if
(
status
!=
STATUS_SUCCESS
)
{
if
(
!
interlocked_dec_if_nonzero
(
(
int
*
)
&
variable
->
Ptr
))
status
=
NtWaitForKeyedEvent
(
keyed_event
,
&
variable
->
Ptr
,
FALSE
,
NULL
);
status
=
NtWaitForKeyedEvent
(
0
,
&
variable
->
Ptr
,
FALSE
,
NULL
);
}
if
(
flags
&
RTL_CONDITION_VARIABLE_LOCKMODE_SHARED
)
...
...
@@ -1986,7 +1988,7 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
return
STATUS_INVALID_PARAMETER
;
}
return
NtWaitForKeyedEvent
(
keyed_event
,
addr
,
0
,
timeout
);
return
NtWaitForKeyedEvent
(
0
,
addr
,
0
,
timeout
);
}
/***********************************************************************
...
...
@@ -1994,7 +1996,7 @@ NTSTATUS WINAPI RtlWaitOnAddress( const void *addr, const void *cmp, SIZE_T size
*/
void
WINAPI
RtlWakeAddressAll
(
const
void
*
addr
)
{
while
(
NtReleaseKeyedEvent
(
keyed_event
,
addr
,
0
,
&
zero_timeout
)
==
STATUS_SUCCESS
)
{}
while
(
NtReleaseKeyedEvent
(
0
,
addr
,
0
,
&
zero_timeout
)
==
STATUS_SUCCESS
)
{}
}
/***********************************************************************
...
...
@@ -2002,5 +2004,5 @@ void WINAPI RtlWakeAddressAll( const void *addr )
*/
void
WINAPI
RtlWakeAddressSingle
(
const
void
*
addr
)
{
NtReleaseKeyedEvent
(
keyed_event
,
addr
,
0
,
&
zero_timeout
);
NtReleaseKeyedEvent
(
0
,
addr
,
0
,
&
zero_timeout
);
}
dlls/ntdll/tests/om.c
View file @
a0050be1
...
...
@@ -1760,10 +1760,10 @@ static void test_keyed_events(void)
ok
(
status
==
STATUS_TIMEOUT
,
"NtReleaseKeyedEvent %x
\n
"
,
status
);
status
=
pNtWaitForKeyedEvent
(
NULL
,
(
void
*
)
8
,
0
,
&
timeout
);
todo_wine
ok
(
status
==
STATUS_TIMEOUT
||
broken
(
status
==
STATUS_INVALID_HANDLE
),
/* XP/2003 */
ok
(
status
==
STATUS_TIMEOUT
||
broken
(
status
==
STATUS_INVALID_HANDLE
),
/* XP/2003 */
"NtWaitForKeyedEvent %x
\n
"
,
status
);
status
=
pNtReleaseKeyedEvent
(
NULL
,
(
void
*
)
8
,
0
,
&
timeout
);
todo_wine
ok
(
status
==
STATUS_TIMEOUT
||
broken
(
status
==
STATUS_INVALID_HANDLE
),
/* XP/2003 */
ok
(
status
==
STATUS_TIMEOUT
||
broken
(
status
==
STATUS_INVALID_HANDLE
),
/* XP/2003 */
"NtReleaseKeyedEvent %x
\n
"
,
status
);
status
=
pNtWaitForKeyedEvent
(
(
HANDLE
)
0xdeadbeef
,
(
void
*
)
9
,
0
,
&
timeout
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment