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
87164ee3
Commit
87164ee3
authored
Nov 17, 2021
by
Zebediah Figura
Committed by
Alexandre Julliard
Nov 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Get rid of the direct futex path for condition variables.
Signed-off-by:
Zebediah Figura
<
zfigura@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c577ce26
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
9 additions
and
96 deletions
+9
-96
sync.c
dlls/ntdll/sync.c
+8
-16
loader.c
dlls/ntdll/unix/loader.c
+0
-2
sync.c
dlls/ntdll/unix/sync.c
+0
-71
unix_private.h
dlls/ntdll/unix/unix_private.h
+0
-3
unixlib.h
dlls/ntdll/unixlib.h
+1
-4
No files found.
dlls/ntdll/sync.c
View file @
87164ee3
...
...
@@ -792,11 +792,8 @@ void WINAPI RtlInitializeConditionVariable( RTL_CONDITION_VARIABLE *variable )
*/
void
WINAPI
RtlWakeConditionVariable
(
RTL_CONDITION_VARIABLE
*
variable
)
{
if
(
unix_funcs
->
fast_RtlWakeConditionVariable
(
variable
,
1
)
==
STATUS_NOT_IMPLEMENTED
)
{
InterlockedIncrement
(
(
int
*
)
&
variable
->
Ptr
);
RtlWakeAddressSingle
(
variable
);
}
InterlockedIncrement
(
(
int
*
)
&
variable
->
Ptr
);
RtlWakeAddressSingle
(
variable
);
}
/***********************************************************************
...
...
@@ -806,11 +803,8 @@ void WINAPI RtlWakeConditionVariable( RTL_CONDITION_VARIABLE *variable )
*/
void
WINAPI
RtlWakeAllConditionVariable
(
RTL_CONDITION_VARIABLE
*
variable
)
{
if
(
unix_funcs
->
fast_RtlWakeConditionVariable
(
variable
,
INT_MAX
)
==
STATUS_NOT_IMPLEMENTED
)
{
InterlockedIncrement
(
(
int
*
)
&
variable
->
Ptr
);
RtlWakeAddressAll
(
variable
);
}
InterlockedIncrement
(
(
int
*
)
&
variable
->
Ptr
);
RtlWakeAddressAll
(
variable
);
}
/***********************************************************************
...
...
@@ -831,12 +825,11 @@ void WINAPI RtlWakeAllConditionVariable( RTL_CONDITION_VARIABLE *variable )
NTSTATUS
WINAPI
RtlSleepConditionVariableCS
(
RTL_CONDITION_VARIABLE
*
variable
,
RTL_CRITICAL_SECTION
*
crit
,
const
LARGE_INTEGER
*
timeout
)
{
const
void
*
value
=
variable
->
Ptr
;
int
value
=
*
(
int
*
)
&
variable
->
Ptr
;
NTSTATUS
status
;
RtlLeaveCriticalSection
(
crit
);
if
((
status
=
unix_funcs
->
fast_wait_cv
(
variable
,
value
,
timeout
))
==
STATUS_NOT_IMPLEMENTED
)
status
=
RtlWaitOnAddress
(
&
variable
->
Ptr
,
&
value
,
sizeof
(
value
),
timeout
);
status
=
RtlWaitOnAddress
(
&
variable
->
Ptr
,
&
value
,
sizeof
(
value
),
timeout
);
RtlEnterCriticalSection
(
crit
);
return
status
;
}
...
...
@@ -863,7 +856,7 @@ NTSTATUS WINAPI RtlSleepConditionVariableCS( RTL_CONDITION_VARIABLE *variable, R
NTSTATUS
WINAPI
RtlSleepConditionVariableSRW
(
RTL_CONDITION_VARIABLE
*
variable
,
RTL_SRWLOCK
*
lock
,
const
LARGE_INTEGER
*
timeout
,
ULONG
flags
)
{
const
void
*
value
=
variable
->
Ptr
;
int
value
=
*
(
int
*
)
&
variable
->
Ptr
;
NTSTATUS
status
;
if
(
flags
&
RTL_CONDITION_VARIABLE_LOCKMODE_SHARED
)
...
...
@@ -871,8 +864,7 @@ NTSTATUS WINAPI RtlSleepConditionVariableSRW( RTL_CONDITION_VARIABLE *variable,
else
RtlReleaseSRWLockExclusive
(
lock
);
if
((
status
=
unix_funcs
->
fast_wait_cv
(
variable
,
value
,
timeout
))
==
STATUS_NOT_IMPLEMENTED
)
status
=
RtlWaitOnAddress
(
variable
,
&
value
,
sizeof
(
value
),
timeout
);
status
=
RtlWaitOnAddress
(
&
variable
->
Ptr
,
&
value
,
sizeof
(
value
),
timeout
);
if
(
flags
&
RTL_CONDITION_VARIABLE_LOCKMODE_SHARED
)
RtlAcquireSRWLockShared
(
lock
);
...
...
dlls/ntdll/unix/loader.c
View file @
87164ee3
...
...
@@ -2151,8 +2151,6 @@ static struct unix_funcs unix_funcs =
fast_RtlAcquireSRWLockShared
,
fast_RtlReleaseSRWLockExclusive
,
fast_RtlReleaseSRWLockShared
,
fast_RtlWakeConditionVariable
,
fast_wait_cv
,
load_so_dll
,
init_builtin_dll
,
init_unix_lib
,
...
...
dlls/ntdll/unix/sync.c
View file @
87164ee3
...
...
@@ -162,23 +162,6 @@ static int *get_futex(void **ptr)
return
NULL
;
}
static
void
timespec_from_timeout
(
struct
timespec
*
timespec
,
const
LARGE_INTEGER
*
timeout
)
{
LARGE_INTEGER
now
;
timeout_t
diff
;
if
(
timeout
->
QuadPart
>
0
)
{
NtQuerySystemTime
(
&
now
);
diff
=
timeout
->
QuadPart
-
now
.
QuadPart
;
}
else
diff
=
-
timeout
->
QuadPart
;
timespec
->
tv_sec
=
diff
/
TICKSPERSEC
;
timespec
->
tv_nsec
=
(
diff
%
TICKSPERSEC
)
*
100
;
}
#endif
...
...
@@ -2802,50 +2785,6 @@ NTSTATUS CDECL fast_RtlReleaseSRWLockShared( RTL_SRWLOCK *lock )
return
STATUS_SUCCESS
;
}
NTSTATUS
CDECL
fast_wait_cv
(
RTL_CONDITION_VARIABLE
*
variable
,
const
void
*
value
,
const
LARGE_INTEGER
*
timeout
)
{
const
char
*
value_ptr
;
int
aligned_value
,
*
futex
;
struct
timespec
timespec
;
int
ret
;
if
(
!
use_futexes
())
return
STATUS_NOT_IMPLEMENTED
;
if
(
!
(
futex
=
get_futex
(
&
variable
->
Ptr
)))
return
STATUS_NOT_IMPLEMENTED
;
value_ptr
=
(
const
char
*
)
&
value
;
value_ptr
+=
((
ULONG_PTR
)
futex
)
-
((
ULONG_PTR
)
&
variable
->
Ptr
);
aligned_value
=
*
(
int
*
)
value_ptr
;
if
(
timeout
&&
timeout
->
QuadPart
!=
TIMEOUT_INFINITE
)
{
timespec_from_timeout
(
&
timespec
,
timeout
);
ret
=
futex_wait
(
futex
,
aligned_value
,
&
timespec
);
}
else
ret
=
futex_wait
(
futex
,
aligned_value
,
NULL
);
if
(
ret
==
-
1
&&
errno
==
ETIMEDOUT
)
return
STATUS_TIMEOUT
;
return
STATUS_WAIT_0
;
}
NTSTATUS
CDECL
fast_RtlWakeConditionVariable
(
RTL_CONDITION_VARIABLE
*
variable
,
int
count
)
{
int
*
futex
;
if
(
!
use_futexes
())
return
STATUS_NOT_IMPLEMENTED
;
if
(
!
(
futex
=
get_futex
(
&
variable
->
Ptr
)))
return
STATUS_NOT_IMPLEMENTED
;
InterlockedIncrement
(
futex
);
futex_wake
(
futex
,
count
);
return
STATUS_SUCCESS
;
}
#else
NTSTATUS
CDECL
fast_RtlTryAcquireSRWLockExclusive
(
RTL_SRWLOCK
*
lock
)
...
...
@@ -2878,14 +2817,4 @@ NTSTATUS CDECL fast_RtlReleaseSRWLockShared( RTL_SRWLOCK *lock )
return
STATUS_NOT_IMPLEMENTED
;
}
NTSTATUS
CDECL
fast_RtlWakeConditionVariable
(
RTL_CONDITION_VARIABLE
*
variable
,
int
count
)
{
return
STATUS_NOT_IMPLEMENTED
;
}
NTSTATUS
CDECL
fast_wait_cv
(
RTL_CONDITION_VARIABLE
*
variable
,
const
void
*
value
,
const
LARGE_INTEGER
*
timeout
)
{
return
STATUS_NOT_IMPLEMENTED
;
}
#endif
dlls/ntdll/unix/unix_private.h
View file @
87164ee3
...
...
@@ -106,10 +106,7 @@ extern NTSTATUS CDECL fast_RtlTryAcquireSRWLockShared( RTL_SRWLOCK *lock ) DECLS
extern
NTSTATUS
CDECL
fast_RtlAcquireSRWLockShared
(
RTL_SRWLOCK
*
lock
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
CDECL
fast_RtlReleaseSRWLockExclusive
(
RTL_SRWLOCK
*
lock
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
CDECL
fast_RtlReleaseSRWLockShared
(
RTL_SRWLOCK
*
lock
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
CDECL
fast_RtlWakeConditionVariable
(
RTL_CONDITION_VARIABLE
*
variable
,
int
count
)
DECLSPEC_HIDDEN
;
extern
LONGLONG
CDECL
fast_RtlGetSystemTimePrecise
(
void
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
CDECL
fast_wait_cv
(
RTL_CONDITION_VARIABLE
*
variable
,
const
void
*
value
,
const
LARGE_INTEGER
*
timeout
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
CDECL
unwind_builtin_dll
(
ULONG
type
,
struct
_DISPATCHER_CONTEXT
*
dispatch
,
CONTEXT
*
context
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/unixlib.h
View file @
87164ee3
...
...
@@ -26,7 +26,7 @@
struct
_DISPATCHER_CONTEXT
;
/* increment this when you change the function table */
#define NTDLL_UNIXLIB_VERSION 13
0
#define NTDLL_UNIXLIB_VERSION 13
1
struct
unix_funcs
{
...
...
@@ -45,9 +45,6 @@ struct unix_funcs
NTSTATUS
(
CDECL
*
fast_RtlAcquireSRWLockShared
)(
RTL_SRWLOCK
*
lock
);
NTSTATUS
(
CDECL
*
fast_RtlReleaseSRWLockExclusive
)(
RTL_SRWLOCK
*
lock
);
NTSTATUS
(
CDECL
*
fast_RtlReleaseSRWLockShared
)(
RTL_SRWLOCK
*
lock
);
NTSTATUS
(
CDECL
*
fast_RtlWakeConditionVariable
)(
RTL_CONDITION_VARIABLE
*
variable
,
int
count
);
NTSTATUS
(
CDECL
*
fast_wait_cv
)(
RTL_CONDITION_VARIABLE
*
variable
,
const
void
*
value
,
const
LARGE_INTEGER
*
timeout
);
/* loader functions */
NTSTATUS
(
CDECL
*
load_so_dll
)(
UNICODE_STRING
*
nt_name
,
void
**
module
);
...
...
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