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
a8830a24
Commit
a8830a24
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: Call group cancel callback with the correct arguments.
Signed-off-by:
Sebastian Lackner
<
sebastian@fds-team.de
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
51447083
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
50 additions
and
11 deletions
+50
-11
threadpool.c
dlls/ntdll/tests/threadpool.c
+46
-8
threadpool.c
dlls/ntdll/threadpool.c
+4
-3
No files found.
dlls/ntdll/tests/threadpool.c
View file @
a8830a24
...
...
@@ -813,21 +813,25 @@ static void test_tp_group_wait(void)
static
DWORD
group_cancel_tid
;
static
void
CALLBACK
group_cancel_cb
(
TP_CALLBACK_INSTANCE
*
instance
,
void
*
userdata
)
static
void
CALLBACK
simple_
group_cancel_cb
(
TP_CALLBACK_INSTANCE
*
instance
,
void
*
userdata
)
{
HANDLE
*
semaphores
=
userdata
;
NTSTATUS
status
;
DWORD
result
;
int
i
;
trace
(
"Running group cancel callback
\n
"
);
trace
(
"Running
simple
group cancel callback
\n
"
);
status
=
pTpCallbackMayRunLong
(
instance
);
ok
(
status
==
STATUS_TOO_MANY_THREADS
||
broken
(
status
==
1
)
/* Win Vista / 2008 */
,
"expected STATUS_TOO_MANY_THREADS, got %08x
\n
"
,
status
);
ReleaseSemaphore
(
semaphores
[
1
],
1
,
NULL
);
result
=
WaitForSingleObject
(
semaphores
[
0
],
1000
);
ok
(
result
==
WAIT_OBJECT_0
,
"WaitForSingleObject returned %u
\n
"
,
result
);
for
(
i
=
0
;
i
<
4
;
i
++
)
{
result
=
WaitForSingleObject
(
semaphores
[
0
],
1000
);
ok
(
result
==
WAIT_OBJECT_0
,
"WaitForSingleObject returned %u
\n
"
,
result
);
}
ReleaseSemaphore
(
semaphores
[
1
],
1
,
NULL
);
}
...
...
@@ -836,6 +840,7 @@ static void CALLBACK group_cancel_cleanup_release_cb(void *object, void *userdat
HANDLE
*
semaphores
=
userdata
;
trace
(
"Running group cancel cleanup release callback
\n
"
);
group_cancel_tid
=
GetCurrentThreadId
();
ok
(
object
==
(
void
*
)
0xdeadbeef
,
"expected 0xdeadbeef, got %p
\n
"
,
object
);
ReleaseSemaphore
(
semaphores
[
0
],
1
,
NULL
);
}
...
...
@@ -846,7 +851,23 @@ static void CALLBACK group_cancel_cleanup_increment_cb(void *object, void *userd
InterlockedIncrement
((
LONG
*
)
userdata
);
}
static
void
CALLBACK
unexpected_cb
(
TP_CALLBACK_INSTANCE
*
instance
,
void
*
userdata
)
static
void
CALLBACK
unexpected_simple_cb
(
TP_CALLBACK_INSTANCE
*
instance
,
void
*
userdata
)
{
ok
(
0
,
"Unexpected callback
\n
"
);
}
static
void
CALLBACK
unexpected_work_cb
(
TP_CALLBACK_INSTANCE
*
instance
,
void
*
userdata
,
TP_WORK
*
work
)
{
ok
(
0
,
"Unexpected callback
\n
"
);
}
static
void
CALLBACK
unexpected_timer_cb
(
TP_CALLBACK_INSTANCE
*
instance
,
void
*
userdata
,
TP_TIMER
*
timer
)
{
ok
(
0
,
"Unexpected callback
\n
"
);
}
static
void
CALLBACK
unexpected_wait_cb
(
TP_CALLBACK_INSTANCE
*
instance
,
void
*
userdata
,
TP_WAIT
*
wait
,
TP_WAIT_RESULT
result
)
{
ok
(
0
,
"Unexpected callback
\n
"
);
}
...
...
@@ -858,12 +879,14 @@ static void test_tp_group_cancel(void)
LONG
userdata
,
userdata2
;
HANDLE
semaphores
[
2
];
NTSTATUS
status
;
TP_TIMER
*
timer
;
TP_WAIT
*
wait
;
TP_WORK
*
work
;
TP_POOL
*
pool
;
DWORD
result
;
int
i
;
semaphores
[
0
]
=
CreateSemaphoreA
(
NULL
,
0
,
1
,
NULL
);
semaphores
[
0
]
=
CreateSemaphoreA
(
NULL
,
0
,
4
,
NULL
);
ok
(
semaphores
[
0
]
!=
NULL
,
"CreateSemaphoreA failed %u
\n
"
,
GetLastError
());
semaphores
[
1
]
=
CreateSemaphoreA
(
NULL
,
0
,
1
,
NULL
);
ok
(
semaphores
[
1
]
!=
NULL
,
"CreateSemaphoreA failed %u
\n
"
,
GetLastError
());
...
...
@@ -885,7 +908,7 @@ static void test_tp_group_cancel(void)
memset
(
&
environment
,
0
,
sizeof
(
environment
));
environment
.
Version
=
1
;
environment
.
Pool
=
pool
;
status
=
pTpSimpleTryPost
(
group_cancel_cb
,
semaphores
,
&
environment
);
status
=
pTpSimpleTryPost
(
simple_
group_cancel_cb
,
semaphores
,
&
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
);
...
...
@@ -895,9 +918,24 @@ static void test_tp_group_cancel(void)
environment
.
Pool
=
pool
;
environment
.
CleanupGroup
=
group
;
environment
.
CleanupGroupCancelCallback
=
group_cancel_cleanup_release_cb
;
status
=
pTpSimpleTryPost
(
unexpected_
cb
,
NULL
,
&
environment
);
status
=
pTpSimpleTryPost
(
unexpected_
simple_cb
,
(
void
*
)
0xdeadbeef
,
&
environment
);
ok
(
!
status
,
"TpSimpleTryPost failed with status %x
\n
"
,
status
);
work
=
NULL
;
status
=
pTpAllocWork
(
&
work
,
unexpected_work_cb
,
(
void
*
)
0xdeadbeef
,
&
environment
);
ok
(
!
status
,
"TpAllocWork failed with status %x
\n
"
,
status
);
ok
(
work
!=
NULL
,
"expected work != NULL
\n
"
);
timer
=
NULL
;
status
=
pTpAllocTimer
(
&
timer
,
unexpected_timer_cb
,
(
void
*
)
0xdeadbeef
,
&
environment
);
ok
(
!
status
,
"TpAllocTimer failed with status %x
\n
"
,
status
);
ok
(
timer
!=
NULL
,
"expected timer != NULL
\n
"
);
wait
=
NULL
;
status
=
pTpAllocWait
(
&
wait
,
unexpected_wait_cb
,
(
void
*
)
0xdeadbeef
,
&
environment
);
ok
(
!
status
,
"TpAllocWait failed with status %x
\n
"
,
status
);
ok
(
wait
!=
NULL
,
"expected wait != NULL
\n
"
);
group_cancel_tid
=
0xdeadbeef
;
pTpReleaseCleanupGroupMembers
(
group
,
TRUE
,
semaphores
);
result
=
WaitForSingleObject
(
semaphores
[
1
],
1000
);
...
...
dlls/ntdll/threadpool.c
View file @
a8830a24
...
...
@@ -1966,10 +1966,11 @@ static void tp_object_cancel( struct threadpool_object *object, BOOL group_cance
RtlLeaveCriticalSection
(
&
pool
->
cs
);
/* Execute group cancellation callback if defined, and if this was actually a group cancel. */
if
(
pending_callbacks
&&
group_cancel
&&
object
->
group_cancel_callback
)
if
(
group_cancel
&&
object
->
group_cancel_callback
)
{
TRACE
(
"executing group cancel callback %p(%p, %p)
\n
"
,
object
->
group_cancel_callback
,
object
,
userdata
);
object
->
group_cancel_callback
(
object
,
userdata
);
TRACE
(
"executing group cancel callback %p(%p, %p)
\n
"
,
object
->
group_cancel_callback
,
object
->
userdata
,
userdata
);
object
->
group_cancel_callback
(
object
->
userdata
,
userdata
);
TRACE
(
"callback %p returned
\n
"
,
object
->
group_cancel_callback
);
}
...
...
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