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
a240d380
Commit
a240d380
authored
Sep 18, 2023
by
Piotr Caban
Committed by
Alexandre Julliard
Sep 18, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
msvcr110: Use Context blocking functions in _StructuredTaskCollection class.
parent
a035c639
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
16 deletions
+21
-16
concurrency.c
dlls/msvcrt/concurrency.c
+21
-16
No files found.
dlls/msvcrt/concurrency.c
View file @
a240d380
...
...
@@ -193,7 +193,7 @@ typedef struct _StructuredTaskCollection
volatile
LONG
count
;
volatile
LONG
finished
;
void
*
exception
;
void
*
event
;
Context
*
event
;
}
_StructuredTaskCollection
;
bool
__thiscall
_StructuredTaskCollection__IsCanceling
(
_StructuredTaskCollection
*
);
...
...
@@ -2118,8 +2118,8 @@ void __thiscall _StructuredTaskCollection__Cancel(
ThreadScheduler
*
scheduler
;
void
*
prev_exception
,
*
new_exception
;
struct
scheduled_chore
*
sc
,
*
next
;
LONG
removed
=
0
,
finished
=
1
;
struct
beacon
*
beacon
;
LONG
removed
=
0
;
TRACE
(
"(%p)
\n
"
,
this
);
...
...
@@ -2162,8 +2162,9 @@ void __thiscall _StructuredTaskCollection__Cancel(
return
;
if
(
InterlockedCompareExchange
(
&
this
->
finished
,
removed
,
FINISHED_INITIAL
)
!=
FINISHED_INITIAL
)
InterlockedAdd
(
&
this
->
finished
,
removed
);
RtlWakeAddressAll
((
LONG
*
)
&
this
->
finished
);
finished
=
InterlockedAdd
(
&
this
->
finished
,
removed
);
if
(
!
finished
)
call_Context_Unblock
(
this
->
event
);
}
static
LONG
CALLBACK
execute_chore_except
(
EXCEPTION_POINTERS
*
pexc
,
void
*
_data
)
...
...
@@ -2240,21 +2241,20 @@ static void execute_chore(_UnrealizedChore *chore,
static
void
CALLBACK
chore_wrapper_finally
(
BOOL
normal
,
void
*
data
)
{
_UnrealizedChore
*
chore
=
data
;
LONG
count
;
volatile
LONG
*
ptr
;
LONG
finished
=
1
;
TRACE
(
"(%u %p)
\n
"
,
normal
,
data
);
if
(
!
chore
->
task_collection
)
return
;
ptr
=
&
chore
->
task_collection
->
finished
;
count
=
chore
->
task_collection
->
count
;
chore
->
task_collection
=
NULL
;
if
(
InterlockedCompareExchange
(
ptr
,
1
,
FINISHED_INITIAL
)
!=
FINISHED_INITIAL
)
InterlockedIncrement
(
ptr
);
if
(
*
ptr
>=
count
)
RtlWakeAddressSingle
((
LONG
*
)
ptr
);
finished
=
InterlockedIncrement
(
ptr
);
if
(
!
finished
)
call_Context_Unblock
(
chore
->
task_collection
->
event
);
chore
->
task_collection
=
NULL
;
}
static
void
__cdecl
chore_wrapper
(
_UnrealizedChore
*
chore
)
...
...
@@ -2393,9 +2393,9 @@ static void CALLBACK exception_ptr_rethrow_finally(BOOL normal, void *data)
_TaskCollectionStatus
__stdcall
_StructuredTaskCollection__RunAndWait
(
_StructuredTaskCollection
*
this
,
_UnrealizedChore
*
chore
)
{
LONG
expected
,
val
;
ULONG_PTR
exception
;
exception_ptr
*
ep
;
LONG
count
;
TRACE
(
"(%p %p)
\n
"
,
this
,
chore
);
...
...
@@ -2415,12 +2415,17 @@ _TaskCollectionStatus __stdcall _StructuredTaskCollection__RunAndWait(
}
}
expected
=
this
->
count
?
this
->
count
:
FINISHED_INITIAL
;
while
((
val
=
this
->
finished
)
!=
expected
)
RtlWaitOnAddress
((
LONG
*
)
&
this
->
finished
,
&
val
,
sizeof
(
val
),
NULL
);
this
->
event
=
get_current_context
();
InterlockedCompareExchange
(
&
this
->
finished
,
0
,
FINISHED_INITIAL
);
this
->
finished
=
0
;
this
->
count
=
0
;
while
(
this
->
count
!=
0
)
{
count
=
this
->
count
;
InterlockedAdd
(
&
this
->
count
,
-
count
);
count
=
InterlockedAdd
(
&
this
->
finished
,
-
count
);
if
(
count
<
0
)
call_Context_Block
(
this
->
event
);
}
exception
=
(
ULONG_PTR
)
this
->
exception
;
ep
=
(
exception_ptr
*
)(
exception
&
~
STRUCTURED_TASK_COLLECTION_STATUS_MASK
);
...
...
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