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
a9f648ef
Commit
a9f648ef
authored
Aug 20, 2016
by
Sebastian Lackner
Committed by
Alexandre Julliard
Aug 22, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Do not call group cancel callback for finished simple callbacks.
Signed-off-by:
Sebastian Lackner
<
sebastian@fds-team.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
be7bcdc0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
32 additions
and
7 deletions
+32
-7
threadpool.c
dlls/ntdll/tests/threadpool.c
+20
-0
threadpool.c
dlls/ntdll/threadpool.c
+12
-7
No files found.
dlls/ntdll/tests/threadpool.c
View file @
a9f648ef
...
...
@@ -705,6 +705,14 @@ static void test_tp_work_scheduler(void)
pTpReleasePool
(
pool
);
}
static
void
CALLBACK
simple_release_cb
(
TP_CALLBACK_INSTANCE
*
instance
,
void
*
userdata
)
{
HANDLE
*
semaphores
=
userdata
;
trace
(
"Running simple release callback
\n
"
);
ReleaseSemaphore
(
semaphores
,
1
,
NULL
);
Sleep
(
200
);
/* wait until main thread is in TpReleaseCleanupGroupMembers */
}
static
void
CALLBACK
work_release_cb
(
TP_CALLBACK_INSTANCE
*
instance
,
void
*
userdata
,
TP_WORK
*
work
)
{
HANDLE
semaphore
=
userdata
;
...
...
@@ -1008,6 +1016,18 @@ static void test_tp_group_cancel(void)
ok
(
result
==
WAIT_OBJECT_0
,
"WaitForSingleObject returned %u
\n
"
,
result
);
pTpReleaseCleanupGroupMembers
(
group
,
TRUE
,
NULL
);
/* terminated simple callbacks should not trigger the group cancel callback */
memset
(
&
environment
,
0
,
sizeof
(
environment
));
environment
.
Version
=
1
;
environment
.
Pool
=
pool
;
environment
.
CleanupGroup
=
group
;
environment
.
CleanupGroupCancelCallback
=
unexpected_group_cancel_cleanup_cb
;
status
=
pTpSimpleTryPost
(
simple_release_cb
,
semaphores
[
1
],
&
environment
);
ok
(
!
status
,
"TpSimpleTryPost failed with status %x
\n
"
,
status
);
result
=
WaitForSingleObject
(
semaphores
[
1
],
1000
);
ok
(
result
==
WAIT_OBJECT_0
,
"WaitForSingleObject returned %u
\n
"
,
result
);
pTpReleaseCleanupGroupMembers
(
group
,
TRUE
,
semaphores
);
/* test cancellation callback for objects with multiple instances */
work
=
NULL
;
memset
(
&
environment
,
0
,
sizeof
(
environment
));
...
...
dlls/ntdll/threadpool.c
View file @
a9f648ef
...
...
@@ -1885,11 +1885,7 @@ static void tp_object_initialize( struct threadpool_object *object, struct threa
}
if
(
is_simple_callback
)
{
tp_object_prepare_shutdown
(
object
);
object
->
shutdown
=
TRUE
;
tp_object_release
(
object
);
}
}
/***********************************************************************
...
...
@@ -2185,6 +2181,13 @@ static void CALLBACK threadpool_worker_proc( void *param )
RtlEnterCriticalSection
(
&
pool
->
cs
);
pool
->
num_busy_workers
--
;
/* Simple callbacks are automatically shutdown after execution. */
if
(
object
->
type
==
TP_OBJECT_TYPE_SIMPLE
)
{
tp_object_prepare_shutdown
(
object
);
object
->
shutdown
=
TRUE
;
}
object
->
num_running_callbacks
--
;
if
(
!
object
->
num_pending_callbacks
&&
!
object
->
num_running_callbacks
)
RtlWakeAllConditionVariable
(
&
object
->
group_finished_event
);
...
...
@@ -2598,9 +2601,10 @@ VOID WINAPI TpReleaseCleanupGroupMembers( TP_CLEANUP_GROUP *group, BOOL cancel_p
{
tp_object_wait
(
object
,
TRUE
);
if
(
!
object
->
shutdown
)
{
/* Execute group cancellation callback if defined, and if this was actually a group cancel. */
if
((
object
->
type
==
TP_OBJECT_TYPE_SIMPLE
||
!
object
->
shutdown
)
&&
cancel_pending
&&
object
->
group_cancel_callback
)
if
(
cancel_pending
&&
object
->
group_cancel_callback
)
{
TRACE
(
"executing group cancel callback %p(%p, %p)
\n
"
,
object
->
group_cancel_callback
,
object
->
userdata
,
userdata
);
...
...
@@ -2608,8 +2612,9 @@ VOID WINAPI TpReleaseCleanupGroupMembers( TP_CLEANUP_GROUP *group, BOOL cancel_p
TRACE
(
"callback %p returned
\n
"
,
object
->
group_cancel_callback
);
}
if
(
object
->
type
!=
TP_OBJECT_TYPE_SIMPLE
&&
!
object
->
shutdown
)
if
(
object
->
type
!=
TP_OBJECT_TYPE_SIMPLE
)
tp_object_release
(
object
);
}
object
->
shutdown
=
TRUE
;
tp_object_release
(
object
);
...
...
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