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
74d83075
Commit
74d83075
authored
Apr 11, 2020
by
Zebediah Figura
Committed by
Alexandre Julliard
Apr 13, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Factor out object_is_finished().
Signed-off-by:
Zebediah Figura
<
z.figura12@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8bce44e4
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
threadpool.c
dlls/ntdll/threadpool.c
+17
-9
No files found.
dlls/ntdll/threadpool.c
View file @
74d83075
...
@@ -2023,6 +2023,17 @@ static void tp_object_cancel( struct threadpool_object *object )
...
@@ -2023,6 +2023,17 @@ static void tp_object_cancel( struct threadpool_object *object )
tp_object_release
(
object
);
tp_object_release
(
object
);
}
}
static
BOOL
object_is_finished
(
struct
threadpool_object
*
object
,
BOOL
group
)
{
if
(
object
->
num_pending_callbacks
)
return
FALSE
;
if
(
group
)
return
!
object
->
num_running_callbacks
;
else
return
!
object
->
num_associated_callbacks
;
}
/***********************************************************************
/***********************************************************************
* tp_object_wait (internal)
* tp_object_wait (internal)
*
*
...
@@ -2034,14 +2045,11 @@ static void tp_object_wait( struct threadpool_object *object, BOOL group_wait )
...
@@ -2034,14 +2045,11 @@ static void tp_object_wait( struct threadpool_object *object, BOOL group_wait )
struct
threadpool
*
pool
=
object
->
pool
;
struct
threadpool
*
pool
=
object
->
pool
;
RtlEnterCriticalSection
(
&
pool
->
cs
);
RtlEnterCriticalSection
(
&
pool
->
cs
);
if
(
group_wait
)
while
(
!
object_is_finished
(
object
,
group_wait
)
)
{
{
while
(
object
->
num_pending_callbacks
||
object
->
num_running_callbacks
)
if
(
group_wait
)
RtlSleepConditionVariableCS
(
&
object
->
group_finished_event
,
&
pool
->
cs
,
NULL
);
RtlSleepConditionVariableCS
(
&
object
->
group_finished_event
,
&
pool
->
cs
,
NULL
);
}
else
else
{
while
(
object
->
num_pending_callbacks
||
object
->
num_associated_callbacks
)
RtlSleepConditionVariableCS
(
&
object
->
finished_event
,
&
pool
->
cs
,
NULL
);
RtlSleepConditionVariableCS
(
&
object
->
finished_event
,
&
pool
->
cs
,
NULL
);
}
}
RtlLeaveCriticalSection
(
&
pool
->
cs
);
RtlLeaveCriticalSection
(
&
pool
->
cs
);
...
@@ -2261,13 +2269,13 @@ static void CALLBACK threadpool_worker_proc( void *param )
...
@@ -2261,13 +2269,13 @@ static void CALLBACK threadpool_worker_proc( void *param )
}
}
object
->
num_running_callbacks
--
;
object
->
num_running_callbacks
--
;
if
(
!
object
->
num_pending_callbacks
&&
!
object
->
num_running_callbacks
)
if
(
object_is_finished
(
object
,
TRUE
)
)
RtlWakeAllConditionVariable
(
&
object
->
group_finished_event
);
RtlWakeAllConditionVariable
(
&
object
->
group_finished_event
);
if
(
instance
.
associated
)
if
(
instance
.
associated
)
{
{
object
->
num_associated_callbacks
--
;
object
->
num_associated_callbacks
--
;
if
(
!
object
->
num_pending_callbacks
&&
!
object
->
num_associated_callbacks
)
if
(
object_is_finished
(
object
,
FALSE
)
)
RtlWakeAllConditionVariable
(
&
object
->
finished_event
);
RtlWakeAllConditionVariable
(
&
object
->
finished_event
);
}
}
...
@@ -2567,7 +2575,7 @@ VOID WINAPI TpDisassociateCallback( TP_CALLBACK_INSTANCE *instance )
...
@@ -2567,7 +2575,7 @@ VOID WINAPI TpDisassociateCallback( TP_CALLBACK_INSTANCE *instance )
RtlEnterCriticalSection
(
&
pool
->
cs
);
RtlEnterCriticalSection
(
&
pool
->
cs
);
object
->
num_associated_callbacks
--
;
object
->
num_associated_callbacks
--
;
if
(
!
object
->
num_pending_callbacks
&&
!
object
->
num_associated_callbacks
)
if
(
object_is_finished
(
object
,
FALSE
)
)
RtlWakeAllConditionVariable
(
&
object
->
finished_event
);
RtlWakeAllConditionVariable
(
&
object
->
finished_event
);
RtlLeaveCriticalSection
(
&
pool
->
cs
);
RtlLeaveCriticalSection
(
&
pool
->
cs
);
...
...
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