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
7c597313
Commit
7c597313
authored
May 26, 2022
by
Paul Gofman
Committed by
Alexandre Julliard
Jun 09, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Cancel asyncs when thread is terminated.
Signed-off-by:
Paul Gofman
<
pgofman@codeweavers.com
>
parent
5a8ccc15
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
31 additions
and
11 deletions
+31
-11
thread.c
dlls/ntdll/unix/thread.c
+13
-11
async.c
server/async.c
+16
-0
file.h
server/file.h
+1
-0
thread.c
server/thread.c
+1
-0
No files found.
dlls/ntdll/unix/thread.c
View file @
7c597313
...
...
@@ -1610,20 +1610,22 @@ NTSTATUS WINAPI NtAlertThread( HANDLE handle )
NTSTATUS
WINAPI
NtTerminateThread
(
HANDLE
handle
,
LONG
exit_code
)
{
NTSTATUS
ret
;
BOOL
self
=
(
handle
==
GetCurrentThread
())
;
BOOL
self
;
if
(
!
self
||
exit_code
)
SERVER_START_REQ
(
terminate_thread
)
{
SERVER_START_REQ
(
terminate_thread
)
{
req
->
handle
=
wine_server_obj_handle
(
handle
);
req
->
exit_code
=
exit_code
;
ret
=
wine_server_call
(
req
);
self
=
!
ret
&&
reply
->
self
;
}
SERVER_END_REQ
;
req
->
handle
=
wine_server_obj_handle
(
handle
);
req
->
exit_code
=
exit_code
;
ret
=
wine_server_call
(
req
);
self
=
!
ret
&&
reply
->
self
;
}
SERVER_END_REQ
;
if
(
self
)
{
server_select
(
NULL
,
0
,
SELECT_INTERRUPTIBLE
,
0
,
NULL
,
NULL
);
exit_thread
(
exit_code
);
}
if
(
self
)
exit_thread
(
exit_code
);
return
ret
;
}
...
...
server/async.c
View file @
7c597313
...
...
@@ -593,6 +593,22 @@ void cancel_process_asyncs( struct process *process )
cancel_async
(
process
,
NULL
,
NULL
,
0
);
}
void
cancel_terminating_thread_asyncs
(
struct
thread
*
thread
)
{
struct
async
*
async
;
restart:
LIST_FOR_EACH_ENTRY
(
async
,
&
thread
->
process
->
asyncs
,
struct
async
,
process_entry
)
{
if
(
async
->
thread
!=
thread
||
async
->
terminated
||
async
->
canceled
)
continue
;
if
(
async
->
completion
&&
async
->
data
.
apc_context
&&
!
async
->
event
)
continue
;
async
->
canceled
=
1
;
fd_cancel_async
(
async
->
fd
,
async
);
goto
restart
;
}
}
/* wake up async operations on the queue */
void
async_wake_up
(
struct
async_queue
*
queue
,
unsigned
int
status
)
{
...
...
server/file.h
View file @
7c597313
...
...
@@ -245,6 +245,7 @@ extern struct iosb *async_get_iosb( struct async *async );
extern
struct
thread
*
async_get_thread
(
struct
async
*
async
);
extern
struct
async
*
find_pending_async
(
struct
async_queue
*
queue
);
extern
void
cancel_process_asyncs
(
struct
process
*
process
);
extern
void
cancel_terminating_thread_asyncs
(
struct
thread
*
thread
);
static
inline
void
init_async_queue
(
struct
async_queue
*
queue
)
{
...
...
server/thread.c
View file @
7c597313
...
...
@@ -1462,6 +1462,7 @@ DECL_HANDLER(terminate_thread)
thread
->
exit_code
=
req
->
exit_code
;
if
(
thread
!=
current
)
kill_thread
(
thread
,
1
);
else
reply
->
self
=
1
;
cancel_terminating_thread_asyncs
(
thread
);
release_object
(
thread
);
}
}
...
...
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