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
2745228b
Commit
2745228b
authored
Mar 22, 2024
by
Paul Gofman
Committed by
Alexandre Julliard
Mar 22, 2024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Don't use debug info presence to detect critical section global status.
parent
e1606d69
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
28 deletions
+11
-28
sync.c
dlls/ntdll/sync.c
+11
-28
No files found.
dlls/ntdll/sync.c
View file @
2745228b
...
@@ -163,29 +163,16 @@ static const char *crit_section_get_name( const RTL_CRITICAL_SECTION *crit )
...
@@ -163,29 +163,16 @@ static const char *crit_section_get_name( const RTL_CRITICAL_SECTION *crit )
static
inline
HANDLE
get_semaphore
(
RTL_CRITICAL_SECTION
*
crit
)
static
inline
HANDLE
get_semaphore
(
RTL_CRITICAL_SECTION
*
crit
)
{
{
HANDLE
ret
=
crit
->
LockSemaphore
;
if
((
ULONG_PTR
)
crit
->
LockSemaphore
>
1
)
return
crit
->
LockSemaphore
;
if
(
!
ret
)
return
NULL
;
{
HANDLE
sem
;
if
(
NtCreateSemaphore
(
&
sem
,
SEMAPHORE_ALL_ACCESS
,
NULL
,
0
,
1
))
return
0
;
if
(
!
(
ret
=
InterlockedCompareExchangePointer
(
&
crit
->
LockSemaphore
,
sem
,
0
)))
ret
=
sem
;
else
NtClose
(
sem
);
/* somebody beat us to it */
}
return
ret
;
}
}
static
inline
NTSTATUS
wait_semaphore
(
RTL_CRITICAL_SECTION
*
crit
,
int
timeout
)
static
inline
NTSTATUS
wait_semaphore
(
RTL_CRITICAL_SECTION
*
crit
,
int
timeout
)
{
{
LARGE_INTEGER
time
=
{.
QuadPart
=
timeout
*
(
LONGLONG
)
-
10000000
};
LARGE_INTEGER
time
=
{.
QuadPart
=
timeout
*
(
LONGLONG
)
-
10000000
};
HANDLE
sem
=
get_semaphore
(
crit
);
/* debug info is cleared by MakeCriticalSectionGlobal */
if
(
sem
)
return
NtWaitForSingleObject
(
sem
,
FALSE
,
&
time
);
if
(
!
crit_section_has_debuginfo
(
crit
))
{
HANDLE
sem
=
get_semaphore
(
crit
);
return
NtWaitForSingleObject
(
sem
,
FALSE
,
&
time
);
}
else
else
{
{
LONG
*
lock
=
(
LONG
*
)
&
crit
->
LockSemaphore
;
LONG
*
lock
=
(
LONG
*
)
&
crit
->
LockSemaphore
;
...
@@ -276,6 +263,8 @@ ULONG WINAPI RtlSetCriticalSectionSpinCount( RTL_CRITICAL_SECTION *crit, ULONG s
...
@@ -276,6 +263,8 @@ ULONG WINAPI RtlSetCriticalSectionSpinCount( RTL_CRITICAL_SECTION *crit, ULONG s
*/
*/
NTSTATUS
WINAPI
RtlDeleteCriticalSection
(
RTL_CRITICAL_SECTION
*
crit
)
NTSTATUS
WINAPI
RtlDeleteCriticalSection
(
RTL_CRITICAL_SECTION
*
crit
)
{
{
HANDLE
sem
;
crit
->
LockCount
=
-
1
;
crit
->
LockCount
=
-
1
;
crit
->
RecursionCount
=
0
;
crit
->
RecursionCount
=
0
;
crit
->
OwningThread
=
0
;
crit
->
OwningThread
=
0
;
...
@@ -288,11 +277,9 @@ NTSTATUS WINAPI RtlDeleteCriticalSection( RTL_CRITICAL_SECTION *crit )
...
@@ -288,11 +277,9 @@ NTSTATUS WINAPI RtlDeleteCriticalSection( RTL_CRITICAL_SECTION *crit )
crit
->
DebugInfo
=
NULL
;
crit
->
DebugInfo
=
NULL
;
}
}
}
}
else
else
crit
->
DebugInfo
=
NULL
;
{
NtClose
(
crit
->
LockSemaphore
);
if
((
sem
=
get_semaphore
(
crit
)))
NtClose
(
sem
);
crit
->
DebugInfo
=
NULL
;
}
crit
->
LockSemaphore
=
0
;
crit
->
LockSemaphore
=
0
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
...
@@ -335,13 +322,9 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit )
...
@@ -335,13 +322,9 @@ NTSTATUS WINAPI RtlpWaitForCriticalSection( RTL_CRITICAL_SECTION *crit )
NTSTATUS
WINAPI
RtlpUnWaitCriticalSection
(
RTL_CRITICAL_SECTION
*
crit
)
NTSTATUS
WINAPI
RtlpUnWaitCriticalSection
(
RTL_CRITICAL_SECTION
*
crit
)
{
{
NTSTATUS
ret
;
NTSTATUS
ret
;
HANDLE
sem
=
get_semaphore
(
crit
);
/* debug info is cleared by MakeCriticalSectionGlobal */
if
(
sem
)
ret
=
NtReleaseSemaphore
(
sem
,
1
,
NULL
);
if
(
!
crit_section_has_debuginfo
(
crit
))
{
HANDLE
sem
=
get_semaphore
(
crit
);
ret
=
NtReleaseSemaphore
(
sem
,
1
,
NULL
);
}
else
else
{
{
LONG
*
lock
=
(
LONG
*
)
&
crit
->
LockSemaphore
;
LONG
*
lock
=
(
LONG
*
)
&
crit
->
LockSemaphore
;
...
...
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