Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sam Joan Roque-Worcel
wine
Commits
4b155749
Commit
4b155749
authored
24 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
Implemented RtlpWaitForCriticalSection and RtlpUnWaitCriticalSection.
parent
c4a26442
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/ntdll/ntdll.spec
+2
-2
2 additions, 2 deletions
dlls/ntdll/ntdll.spec
scheduler/critsection.c
+46
-28
46 additions, 28 deletions
scheduler/critsection.c
with
48 additions
and
30 deletions
dlls/ntdll/ntdll.spec
+
2
−
2
View file @
4b155749
...
...
@@ -550,8 +550,8 @@ type win32
@ stub RtlpNtOpenKey
@ stub RtlpNtQueryValueKey
@ stub RtlpNtSetValueKey
@ st
ub
RtlpUnWaitCriticalSection
@ st
ub
RtlpWaitForCriticalSection
@ st
dcall RtlpUnWaitCriticalSection(ptr)
RtlpUnWaitCriticalSection
@ st
dcall RtlpWaitForCriticalSection(ptr)
RtlpWaitForCriticalSection
@ stdcall RtlxAnsiStringToUnicodeSize(ptr) RtlAnsiStringToUnicodeSize
@ stdcall RtlxOemStringToUnicodeSize(ptr) RtlOemStringToUnicodeSize
@ stdcall RtlxUnicodeStringToAnsiSize(ptr) RtlUnicodeStringToAnsiSize
...
...
This diff is collapsed.
Click to expand it.
scheduler/critsection.c
+
46
−
28
View file @
4b155749
...
...
@@ -64,6 +64,50 @@ void WINAPI DeleteCriticalSection( CRITICAL_SECTION *crit )
}
/***********************************************************************
* RtlpWaitForCriticalSection (NTDLL.@)
*/
void
WINAPI
RtlpWaitForCriticalSection
(
CRITICAL_SECTION
*
crit
)
{
for
(;;)
{
EXCEPTION_RECORD
rec
;
HANDLE
sem
=
get_semaphore
(
crit
);
DWORD
res
=
WaitForSingleObject
(
sem
,
5000L
);
if
(
res
==
WAIT_TIMEOUT
)
{
ERR
(
"Critical section %p wait timed out, retrying (60 sec)
\n
"
,
crit
);
res
=
WaitForSingleObject
(
sem
,
60000L
);
if
(
res
==
WAIT_TIMEOUT
&&
TRACE_ON
(
relay
)
)
{
ERR
(
"Critical section %p wait timed out, retrying (5 min)
\n
"
,
crit
);
res
=
WaitForSingleObject
(
sem
,
300000L
);
}
}
if
(
res
==
STATUS_WAIT_0
)
break
;
rec
.
ExceptionCode
=
EXCEPTION_CRITICAL_SECTION_WAIT
;
rec
.
ExceptionFlags
=
0
;
rec
.
ExceptionRecord
=
NULL
;
rec
.
ExceptionAddress
=
RtlRaiseException
;
/* sic */
rec
.
NumberParameters
=
1
;
rec
.
ExceptionInformation
[
0
]
=
(
DWORD
)
crit
;
RtlRaiseException
(
&
rec
);
}
}
/***********************************************************************
* RtlpUnWaitCriticalSection (NTDLL.@)
*/
void
WINAPI
RtlpUnWaitCriticalSection
(
CRITICAL_SECTION
*
crit
)
{
HANDLE
sem
=
get_semaphore
(
crit
);
ReleaseSemaphore
(
sem
,
1
,
NULL
);
}
/***********************************************************************
* EnterCriticalSection (KERNEL32.195) (NTDLL.344)
*/
...
...
@@ -78,32 +122,7 @@ void WINAPI EnterCriticalSection( CRITICAL_SECTION *crit )
}
/* Now wait for it */
for
(;;)
{
EXCEPTION_RECORD
rec
;
HANDLE
sem
=
get_semaphore
(
crit
);
DWORD
res
=
WaitForSingleObject
(
sem
,
5000L
);
if
(
res
==
WAIT_TIMEOUT
)
{
ERR
(
"Critical section %p wait timed out, retrying (60 sec)
\n
"
,
crit
);
res
=
WaitForSingleObject
(
sem
,
60000L
);
if
(
res
==
WAIT_TIMEOUT
&&
TRACE_ON
(
relay
)
)
{
ERR
(
"Critical section %p wait timed out, retrying (5 min)
\n
"
,
crit
);
res
=
WaitForSingleObject
(
sem
,
300000L
);
}
}
if
(
res
==
STATUS_WAIT_0
)
break
;
rec
.
ExceptionCode
=
EXCEPTION_CRITICAL_SECTION_WAIT
;
rec
.
ExceptionFlags
=
0
;
rec
.
ExceptionRecord
=
NULL
;
rec
.
ExceptionAddress
=
RtlRaiseException
;
/* sic */
rec
.
NumberParameters
=
1
;
rec
.
ExceptionInformation
[
0
]
=
(
DWORD
)
crit
;
RtlRaiseException
(
&
rec
);
}
RtlpWaitForCriticalSection
(
crit
);
}
crit
->
OwningThread
=
GetCurrentThreadId
();
crit
->
RecursionCount
=
1
;
...
...
@@ -149,8 +168,7 @@ void WINAPI LeaveCriticalSection( CRITICAL_SECTION *crit )
if
(
InterlockedDecrement
(
&
crit
->
LockCount
)
>=
0
)
{
/* Someone is waiting */
HANDLE
sem
=
get_semaphore
(
crit
);
ReleaseSemaphore
(
sem
,
1
,
NULL
);
RtlpUnWaitCriticalSection
(
crit
);
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment