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
fb75c668
Commit
fb75c668
authored
Jan 18, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Avoid heap allocations during thread creation.
parent
735dbc40
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
8 deletions
+2
-8
thread.c
dlls/ntdll/thread.c
+2
-8
No files found.
dlls/ntdll/thread.c
View file @
fb75c668
...
@@ -231,6 +231,7 @@ HANDLE thread_init(void)
...
@@ -231,6 +231,7 @@ HANDLE thread_init(void)
sigstack_total_size
=
get_signal_stack_total_size
();
sigstack_total_size
=
get_signal_stack_total_size
();
while
(
1
<<
sigstack_zero_bits
<
sigstack_total_size
)
sigstack_zero_bits
++
;
while
(
1
<<
sigstack_zero_bits
<
sigstack_total_size
)
sigstack_zero_bits
++
;
assert
(
1
<<
sigstack_zero_bits
==
sigstack_total_size
);
/* must be a power of 2 */
assert
(
1
<<
sigstack_zero_bits
==
sigstack_total_size
);
/* must be a power of 2 */
assert
(
sigstack_total_size
>=
sizeof
(
TEB
)
+
sizeof
(
struct
startup_info
)
);
thread_info
.
teb_size
=
sigstack_total_size
;
thread_info
.
teb_size
=
sigstack_total_size
;
addr
=
NULL
;
addr
=
NULL
;
...
@@ -344,7 +345,6 @@ static void start_thread( struct wine_pthread_thread_info *info )
...
@@ -344,7 +345,6 @@ static void start_thread( struct wine_pthread_thread_info *info )
/* setup the guard page */
/* setup the guard page */
size
=
page_size
;
size
=
page_size
;
NtProtectVirtualMemory
(
NtCurrentProcess
(),
&
teb
->
DeallocationStack
,
&
size
,
PAGE_NOACCESS
,
NULL
);
NtProtectVirtualMemory
(
NtCurrentProcess
(),
&
teb
->
DeallocationStack
,
&
size
,
PAGE_NOACCESS
,
NULL
);
RtlFreeHeap
(
GetProcessHeap
(),
0
,
info
);
RtlAcquirePebLock
();
RtlAcquirePebLock
();
InsertHeadList
(
&
tls_links
,
&
teb
->
TlsLinks
);
InsertHeadList
(
&
tls_links
,
&
teb
->
TlsLinks
);
...
@@ -418,12 +418,6 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
...
@@ -418,12 +418,6 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
if
(
status
)
goto
error
;
if
(
status
)
goto
error
;
if
(
!
(
info
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
sizeof
(
*
info
)
)))
{
status
=
STATUS_NO_MEMORY
;
goto
error
;
}
addr
=
NULL
;
addr
=
NULL
;
size
=
sigstack_total_size
;
size
=
sigstack_total_size
;
if
((
status
=
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
addr
,
sigstack_zero_bits
,
if
((
status
=
NtAllocateVirtualMemory
(
NtCurrentProcess
(),
&
addr
,
sigstack_zero_bits
,
...
@@ -431,6 +425,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
...
@@ -431,6 +425,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
goto
error
;
goto
error
;
teb
=
addr
;
teb
=
addr
;
teb
->
Peb
=
NtCurrentTeb
()
->
Peb
;
teb
->
Peb
=
NtCurrentTeb
()
->
Peb
;
info
=
(
struct
startup_info
*
)(
teb
+
1
);
info
->
pthread_info
.
teb_size
=
size
;
info
->
pthread_info
.
teb_size
=
size
;
if
((
status
=
init_teb
(
teb
)))
goto
error
;
if
((
status
=
init_teb
(
teb
)))
goto
error
;
...
@@ -488,7 +483,6 @@ error:
...
@@ -488,7 +483,6 @@ error:
SIZE_T
size
=
0
;
SIZE_T
size
=
0
;
NtFreeVirtualMemory
(
NtCurrentProcess
(),
&
addr
,
&
size
,
MEM_RELEASE
);
NtFreeVirtualMemory
(
NtCurrentProcess
(),
&
addr
,
&
size
,
MEM_RELEASE
);
}
}
RtlFreeHeap
(
GetProcessHeap
(),
0
,
info
);
if
(
handle
)
NtClose
(
handle
);
if
(
handle
)
NtClose
(
handle
);
close
(
request_pipe
[
1
]
);
close
(
request_pipe
[
1
]
);
return
status
;
return
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