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
9e093936
Commit
9e093936
authored
Nov 21, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use a separate stack when starting new threads.
Based on a patch by Sebastian Lackner. Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ed893d35
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
11 deletions
+22
-11
thread.c
dlls/ntdll/thread.c
+22
-11
No files found.
dlls/ntdll/thread.c
View file @
9e093936
...
...
@@ -23,6 +23,7 @@
#include <assert.h>
#include <stdarg.h>
#include <limits.h>
#include <sys/types.h>
#ifdef HAVE_SYS_MMAN_H
#include <sys/mman.h>
...
...
@@ -468,6 +469,24 @@ void exit_thread( int status )
/***********************************************************************
* thread_startup
*/
static
void
thread_startup
(
void
*
param
)
{
struct
startup_info
*
info
=
param
;
PRTL_THREAD_START_ROUTINE
func
=
info
->
entry_point
;
void
*
arg
=
info
->
entry_arg
;
attach_dlls
(
(
void
*
)
1
);
if
(
TRACE_ON
(
relay
))
DPRINTF
(
"%04x:Starting thread proc %p (arg=%p)
\n
"
,
GetCurrentThreadId
(),
func
,
arg
);
call_thread_entry_point
(
(
LPTHREAD_START_ROUTINE
)
func
,
arg
);
}
/***********************************************************************
* start_thread
*
* Startup routine for a newly created thread.
...
...
@@ -476,8 +495,6 @@ static void start_thread( struct startup_info *info )
{
TEB
*
teb
=
info
->
teb
;
struct
ntdll_thread_data
*
thread_data
=
(
struct
ntdll_thread_data
*
)
&
teb
->
GdiTebBatch
;
PRTL_THREAD_START_ROUTINE
func
=
info
->
entry_point
;
void
*
arg
=
info
->
entry_arg
;
struct
debug_info
debug_info
;
debug_info
.
str_pos
=
debug_info
.
strings
;
...
...
@@ -486,14 +503,9 @@ static void start_thread( struct startup_info *info )
thread_data
->
pthread_id
=
pthread_self
();
signal_init_thread
(
teb
);
server_init_thread
(
func
);
server_init_thread
(
info
->
entry_point
);
attach_dlls
(
(
void
*
)
1
);
if
(
TRACE_ON
(
relay
))
DPRINTF
(
"%04x:Starting thread proc %p (arg=%p)
\n
"
,
GetCurrentThreadId
(),
func
,
arg
);
call_thread_entry_point
(
(
LPTHREAD_START_ROUTINE
)
func
,
arg
);
wine_switch_to_stack
(
thread_startup
,
info
,
teb
->
Tib
.
StackBase
);
}
...
...
@@ -603,8 +615,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
if
((
status
=
virtual_alloc_thread_stack
(
teb
,
stack_reserve
,
stack_commit
)))
goto
error
;
pthread_attr_init
(
&
attr
);
pthread_attr_setstack
(
&
attr
,
teb
->
DeallocationStack
,
(
char
*
)
teb
->
Tib
.
StackBase
-
(
char
*
)
teb
->
DeallocationStack
);
pthread_attr_setstacksize
(
&
attr
,
PTHREAD_STACK_MIN
);
pthread_attr_setscope
(
&
attr
,
PTHREAD_SCOPE_SYSTEM
);
/* force creating a kernel thread */
interlocked_xchg_add
(
&
nb_threads
,
1
);
if
(
pthread_create
(
&
pthread_id
,
&
attr
,
(
void
*
(
*
)(
void
*
))
start_thread
,
info
))
...
...
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