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
7e9f1878
Commit
7e9f1878
authored
Dec 14, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Run the thread/process detach code on the thread stack.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c170a483
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
46 additions
and
41 deletions
+46
-41
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+2
-1
signal_arm.c
dlls/ntdll/signal_arm.c
+6
-6
signal_arm64.c
dlls/ntdll/signal_arm64.c
+6
-6
signal_i386.c
dlls/ntdll/signal_i386.c
+6
-6
signal_powerpc.c
dlls/ntdll/signal_powerpc.c
+6
-6
signal_x86_64.c
dlls/ntdll/signal_x86_64.c
+6
-6
thread.c
dlls/ntdll/thread.c
+14
-10
No files found.
dlls/ntdll/ntdll_misc.h
View file @
7e9f1878
...
@@ -69,6 +69,8 @@ extern void signal_init_thread( TEB *teb ) DECLSPEC_HIDDEN;
...
@@ -69,6 +69,8 @@ extern void signal_init_thread( TEB *teb ) DECLSPEC_HIDDEN;
extern
void
signal_init_process
(
void
)
DECLSPEC_HIDDEN
;
extern
void
signal_init_process
(
void
)
DECLSPEC_HIDDEN
;
extern
void
signal_start_thread
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
,
BOOL
suspend
)
DECLSPEC_HIDDEN
;
extern
void
signal_start_thread
(
LPTHREAD_START_ROUTINE
entry
,
void
*
arg
,
BOOL
suspend
)
DECLSPEC_HIDDEN
;
extern
void
signal_start_process
(
LPTHREAD_START_ROUTINE
entry
,
BOOL
suspend
)
DECLSPEC_HIDDEN
;
extern
void
signal_start_process
(
LPTHREAD_START_ROUTINE
entry
,
BOOL
suspend
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
signal_exit_thread
(
int
status
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
signal_exit_process
(
int
status
)
DECLSPEC_HIDDEN
;
extern
void
version_init
(
const
WCHAR
*
appname
)
DECLSPEC_HIDDEN
;
extern
void
version_init
(
const
WCHAR
*
appname
)
DECLSPEC_HIDDEN
;
extern
void
debug_init
(
void
)
DECLSPEC_HIDDEN
;
extern
void
debug_init
(
void
)
DECLSPEC_HIDDEN
;
extern
HANDLE
thread_init
(
void
)
DECLSPEC_HIDDEN
;
extern
HANDLE
thread_init
(
void
)
DECLSPEC_HIDDEN
;
...
@@ -86,7 +88,6 @@ extern void server_init_process(void) DECLSPEC_HIDDEN;
...
@@ -86,7 +88,6 @@ extern void server_init_process(void) DECLSPEC_HIDDEN;
extern
void
server_init_process_done
(
void
)
DECLSPEC_HIDDEN
;
extern
void
server_init_process_done
(
void
)
DECLSPEC_HIDDEN
;
extern
size_t
server_init_thread
(
void
*
entry_point
,
BOOL
*
suspend
)
DECLSPEC_HIDDEN
;
extern
size_t
server_init_thread
(
void
*
entry_point
,
BOOL
*
suspend
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
abort_thread
(
int
status
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
abort_thread
(
int
status
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
terminate_thread
(
int
status
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
exit_thread
(
int
status
)
DECLSPEC_HIDDEN
;
extern
void
DECLSPEC_NORETURN
exit_thread
(
int
status
)
DECLSPEC_HIDDEN
;
extern
sigset_t
server_block_set
DECLSPEC_HIDDEN
;
extern
sigset_t
server_block_set
DECLSPEC_HIDDEN
;
extern
unsigned
int
server_call_unlocked
(
void
*
req_ptr
)
DECLSPEC_HIDDEN
;
extern
unsigned
int
server_call_unlocked
(
void
*
req_ptr
)
DECLSPEC_HIDDEN
;
...
...
dlls/ntdll/signal_arm.c
View file @
7e9f1878
...
@@ -1233,7 +1233,7 @@ static void call_thread_entry_point( LPTHREAD_START_ROUTINE entry, void *arg )
...
@@ -1233,7 +1233,7 @@ static void call_thread_entry_point( LPTHREAD_START_ROUTINE entry, void *arg )
__TRY
__TRY
{
{
TRACE_
(
relay
)(
"
\1
Starting thread proc %p (arg=%p)
\n
"
,
entry
,
arg
);
TRACE_
(
relay
)(
"
\1
Starting thread proc %p (arg=%p)
\n
"
,
entry
,
arg
);
exit_t
hread
(
entry
(
arg
));
RtlExitUserT
hread
(
entry
(
arg
));
}
}
__EXCEPT
(
unhandled_exception_filter
)
__EXCEPT
(
unhandled_exception_filter
)
{
{
...
@@ -1302,19 +1302,19 @@ void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend )
...
@@ -1302,19 +1302,19 @@ void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend )
}
}
/***********************************************************************
/***********************************************************************
*
RtlExitUserThread (NTDLL.@)
*
signal_exit_thread
*/
*/
void
WINAPI
RtlExitUserThread
(
ULONG
status
)
void
signal_exit_thread
(
int
status
)
{
{
exit_thread
(
status
);
exit_thread
(
status
);
}
}
/***********************************************************************
/***********************************************************************
*
abort_thread
*
signal_exit_process
*/
*/
void
abort_thread
(
int
status
)
void
signal_exit_process
(
int
status
)
{
{
terminate_thread
(
status
);
exit
(
status
);
}
}
/**********************************************************************
/**********************************************************************
...
...
dlls/ntdll/signal_arm64.c
View file @
7e9f1878
...
@@ -965,7 +965,7 @@ static void WINAPI call_thread_entry_point( LPTHREAD_START_ROUTINE entry, void *
...
@@ -965,7 +965,7 @@ static void WINAPI call_thread_entry_point( LPTHREAD_START_ROUTINE entry, void *
__TRY
__TRY
{
{
TRACE_
(
relay
)(
"
\1
Starting thread proc %p (arg=%p)
\n
"
,
entry
,
arg
);
TRACE_
(
relay
)(
"
\1
Starting thread proc %p (arg=%p)
\n
"
,
entry
,
arg
);
exit_t
hread
(
entry
(
arg
));
RtlExitUserT
hread
(
entry
(
arg
));
}
}
__EXCEPT
(
unhandled_exception_filter
)
__EXCEPT
(
unhandled_exception_filter
)
{
{
...
@@ -1034,19 +1034,19 @@ void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend )
...
@@ -1034,19 +1034,19 @@ void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend )
}
}
/***********************************************************************
/***********************************************************************
*
RtlExitUserThread (NTDLL.@)
*
signal_exit_thread
*/
*/
void
WINAPI
RtlExitUserThread
(
ULONG
status
)
void
signal_exit_thread
(
int
status
)
{
{
exit_thread
(
status
);
exit_thread
(
status
);
}
}
/***********************************************************************
/***********************************************************************
*
abort_thread
*
signal_exit_process
*/
*/
void
abort_thread
(
int
status
)
void
signal_exit_process
(
int
status
)
{
{
terminate_thread
(
status
);
exit
(
status
);
}
}
/**********************************************************************
/**********************************************************************
...
...
dlls/ntdll/signal_i386.c
View file @
7e9f1878
...
@@ -2989,21 +2989,21 @@ void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend )
...
@@ -2989,21 +2989,21 @@ void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend )
/***********************************************************************
/***********************************************************************
*
RtlExitUserThread (NTDLL.@)
*
signal_exit_thread
*/
*/
void
WINAPI
RtlExitUserThread
(
ULONG
status
)
void
signal_exit_thread
(
int
status
)
{
{
if
(
!
x86_thread_data
()
->
exit_frame
)
exit_thread
(
status
);
if
(
!
x86_thread_data
()
->
exit_frame
)
exit_thread
(
status
);
call_thread_exit_func
(
status
,
exit_thread
,
x86_thread_data
()
->
exit_frame
);
call_thread_exit_func
(
status
,
exit_thread
,
x86_thread_data
()
->
exit_frame
);
}
}
/***********************************************************************
/***********************************************************************
*
abort_thread
*
signal_exit_process
*/
*/
void
abort_thread
(
int
status
)
void
signal_exit_process
(
int
status
)
{
{
if
(
!
x86_thread_data
()
->
exit_frame
)
terminate_thread
(
status
);
if
(
!
x86_thread_data
()
->
exit_frame
)
exit
(
status
);
call_thread_exit_func
(
status
,
terminate_thread
,
x86_thread_data
()
->
exit_frame
);
call_thread_exit_func
(
status
,
exit
,
x86_thread_data
()
->
exit_frame
);
}
}
/**********************************************************************
/**********************************************************************
...
...
dlls/ntdll/signal_powerpc.c
View file @
7e9f1878
...
@@ -1143,7 +1143,7 @@ static void WINAPI call_thread_entry_point( LPTHREAD_START_ROUTINE entry, void *
...
@@ -1143,7 +1143,7 @@ static void WINAPI call_thread_entry_point( LPTHREAD_START_ROUTINE entry, void *
__TRY
__TRY
{
{
TRACE_
(
relay
)(
"
\1
Starting thread proc %p (arg=%p)
\n
"
,
entry
,
arg
);
TRACE_
(
relay
)(
"
\1
Starting thread proc %p (arg=%p)
\n
"
,
entry
,
arg
);
exit_t
hread
(
entry
(
arg
));
RtlExitUserT
hread
(
entry
(
arg
));
}
}
__EXCEPT
(
unhandled_exception_filter
)
__EXCEPT
(
unhandled_exception_filter
)
{
{
...
@@ -1212,19 +1212,19 @@ void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend )
...
@@ -1212,19 +1212,19 @@ void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend )
}
}
/***********************************************************************
/***********************************************************************
*
RtlExitUserThread (NTDLL.@)
*
signal_exit_thread
*/
*/
void
WINAPI
RtlExitUserThread
(
ULONG
status
)
void
signal_exit_thread
(
int
status
)
{
{
exit_thread
(
status
);
exit_thread
(
status
);
}
}
/***********************************************************************
/***********************************************************************
*
abort_thread
*
signal_exit_process
*/
*/
void
abort_thread
(
int
status
)
void
signal_exit_process
(
int
status
)
{
{
terminate_thread
(
status
);
exit
(
status
);
}
}
/**********************************************************************
/**********************************************************************
...
...
dlls/ntdll/signal_x86_64.c
View file @
7e9f1878
...
@@ -4160,21 +4160,21 @@ void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend )
...
@@ -4160,21 +4160,21 @@ void signal_start_process( LPTHREAD_START_ROUTINE entry, BOOL suspend )
/***********************************************************************
/***********************************************************************
*
RtlExitUserThread (NTDLL.@)
*
signal_exit_thread
*/
*/
void
WINAPI
RtlExitUserThread
(
ULONG
status
)
void
signal_exit_thread
(
int
status
)
{
{
if
(
!
amd64_thread_data
()
->
exit_frame
)
exit_thread
(
status
);
if
(
!
amd64_thread_data
()
->
exit_frame
)
exit_thread
(
status
);
call_thread_exit_func
(
status
,
exit_thread
,
amd64_thread_data
()
->
exit_frame
);
call_thread_exit_func
(
status
,
exit_thread
,
amd64_thread_data
()
->
exit_frame
);
}
}
/***********************************************************************
/***********************************************************************
*
abort_thread
*
signal_exit_process
*/
*/
void
abort_thread
(
int
status
)
void
signal_exit_process
(
int
status
)
{
{
if
(
!
amd64_thread_data
()
->
exit_frame
)
terminate_thread
(
status
);
if
(
!
amd64_thread_data
()
->
exit_frame
)
exit
(
status
);
call_thread_exit_func
(
status
,
terminate_thread
,
amd64_thread_data
()
->
exit_frame
);
call_thread_exit_func
(
status
,
exit
,
amd64_thread_data
()
->
exit_frame
);
}
}
/**********************************************************************
/**********************************************************************
...
...
dlls/ntdll/thread.c
View file @
7e9f1878
...
@@ -426,13 +426,21 @@ static void free_thread_data( TEB *teb )
...
@@ -426,13 +426,21 @@ static void free_thread_data( TEB *teb )
/***********************************************************************
/***********************************************************************
*
terminate
_thread
*
abort
_thread
*/
*/
void
terminate
_thread
(
int
status
)
void
abort
_thread
(
int
status
)
{
{
pthread_sigmask
(
SIG_BLOCK
,
&
server_block_set
,
NULL
);
pthread_sigmask
(
SIG_BLOCK
,
&
server_block_set
,
NULL
);
if
(
interlocked_xchg_add
(
&
nb_threads
,
-
1
)
<=
1
)
_exit
(
status
);
if
(
interlocked_xchg_add
(
&
nb_threads
,
-
1
)
<=
1
)
_exit
(
status
);
signal_exit_thread
(
status
);
}
/***********************************************************************
* exit_thread
*/
void
exit_thread
(
int
status
)
{
close
(
ntdll_get_thread_data
()
->
wait_fd
[
0
]
);
close
(
ntdll_get_thread_data
()
->
wait_fd
[
0
]
);
close
(
ntdll_get_thread_data
()
->
wait_fd
[
1
]
);
close
(
ntdll_get_thread_data
()
->
wait_fd
[
1
]
);
close
(
ntdll_get_thread_data
()
->
reply_fd
);
close
(
ntdll_get_thread_data
()
->
reply_fd
);
...
@@ -442,9 +450,9 @@ void terminate_thread( int status )
...
@@ -442,9 +450,9 @@ void terminate_thread( int status )
/***********************************************************************
/***********************************************************************
*
exit_thread
*
RtlExitUserThread (NTDLL.@)
*/
*/
void
exit_thread
(
int
status
)
void
WINAPI
RtlExitUserThread
(
ULONG
status
)
{
{
static
void
*
prev_teb
;
static
void
*
prev_teb
;
TEB
*
teb
;
TEB
*
teb
;
...
@@ -463,7 +471,7 @@ void exit_thread( int status )
...
@@ -463,7 +471,7 @@ void exit_thread( int status )
if
(
interlocked_xchg_add
(
&
nb_threads
,
-
1
)
<=
1
)
if
(
interlocked_xchg_add
(
&
nb_threads
,
-
1
)
<=
1
)
{
{
LdrShutdownProcess
();
LdrShutdownProcess
();
exit
(
status
);
signal_exit_process
(
status
);
}
}
LdrShutdownThread
();
LdrShutdownThread
();
...
@@ -482,11 +490,7 @@ void exit_thread( int status )
...
@@ -482,11 +490,7 @@ void exit_thread( int status )
}
}
}
}
close
(
ntdll_get_thread_data
()
->
wait_fd
[
0
]
);
signal_exit_thread
(
status
);
close
(
ntdll_get_thread_data
()
->
wait_fd
[
1
]
);
close
(
ntdll_get_thread_data
()
->
reply_fd
);
close
(
ntdll_get_thread_data
()
->
request_fd
);
pthread_exit
(
UIntToPtr
(
status
)
);
}
}
...
...
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