* cygthread.cc (cygthread::async_create): Define new function.
* cygthread.h (cygthread::create): Use correct regparm. (cygthread::standalone): Delete from class and from all constructors. (cygthread::cygthread): Use three only arguments for detached threads, and start the thread via QueueUserAPC/async_create. * dcrt0.cc (dll_crt0_0): Remove handling for wincap.has_buggy_thread_startup. (dll_crt0_1): Ditto. * wincap.cc: Ditto throughout. * wincap.h: Ditto.
This commit is contained in:
parent
f7e198a665
commit
53ad6f1394
|
@ -1,3 +1,16 @@
|
|||
2011-07-30 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||
|
||||
* cygthread.cc (cygthread::async_create): Define new function.
|
||||
* cygthread.h (cygthread::create): Use correct regparm.
|
||||
(cygthread::standalone): Delete from class and from all constructors.
|
||||
(cygthread::cygthread): Use three only arguments for detached threads,
|
||||
and start the thread via QueueUserAPC/async_create.
|
||||
* dcrt0.cc (dll_crt0_0): Remove handling for
|
||||
wincap.has_buggy_thread_startup.
|
||||
(dll_crt0_1): Ditto.
|
||||
* wincap.cc: Ditto throughout.
|
||||
* wincap.h: Ditto.
|
||||
|
||||
2011-07-30 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||
|
||||
* fhandler.h (fhandler_base_overlapped::size): Declare/define size()
|
||||
|
|
|
@ -186,6 +186,17 @@ out:
|
|||
return info;
|
||||
}
|
||||
|
||||
/* This function is called via QueueUserAPC. Apparently creating threads
|
||||
asynchronously is a huge performance win on Win64. */
|
||||
void CALLBACK
|
||||
cygthread::async_create (ULONG_PTR arg)
|
||||
{
|
||||
cygthread *that = (cygthread *) arg;
|
||||
that->create ();
|
||||
::SetThreadPriority (that->h, THREAD_PRIORITY_HIGHEST);
|
||||
that->zap_h ();
|
||||
}
|
||||
|
||||
void
|
||||
cygthread::create ()
|
||||
{
|
||||
|
|
|
@ -31,8 +31,8 @@ class cygthread
|
|||
bool is_freerange;
|
||||
static bool exiting;
|
||||
HANDLE notify_detached;
|
||||
bool standalone;
|
||||
void create () __attribute__ ((regparm(2)));
|
||||
void create () __attribute__ ((regparm (1)));
|
||||
static void CALLBACK async_create (ULONG_PTR);
|
||||
public:
|
||||
bool terminate_thread ();
|
||||
static DWORD WINAPI stub (VOID *);
|
||||
|
@ -44,33 +44,27 @@ class cygthread
|
|||
void release (bool);
|
||||
cygthread (LPTHREAD_START_ROUTINE start, unsigned n, LPVOID param, const char *name, HANDLE notify = NULL)
|
||||
: __name (name), func (start), arglen (n), arg (param),
|
||||
notify_detached (notify), standalone (false)
|
||||
notify_detached (notify)
|
||||
{
|
||||
create ();
|
||||
}
|
||||
cygthread (LPVOID_THREAD_START_ROUTINE start, LPVOID param, const char *name, HANDLE notify = NULL)
|
||||
cygthread (LPVOID_THREAD_START_ROUTINE start, LPVOID param, const char *name)
|
||||
: __name (name), func ((LPTHREAD_START_ROUTINE) start), arglen (0),
|
||||
arg (param), notify_detached (notify), standalone (true)
|
||||
arg (param), notify_detached (NULL)
|
||||
{
|
||||
create ();
|
||||
/* This is a neverending/high-priority thread */
|
||||
::SetThreadPriority (h, THREAD_PRIORITY_HIGHEST);
|
||||
zap_h ();
|
||||
QueueUserAPC (async_create, GetCurrentThread (), (ULONG_PTR) this);
|
||||
}
|
||||
cygthread (LPTHREAD_START_ROUTINE start, LPVOID param, const char *name, HANDLE notify = NULL)
|
||||
: __name (name), func (start), arglen (0), arg (param),
|
||||
notify_detached (notify), standalone (false)
|
||||
notify_detached (notify)
|
||||
{
|
||||
create ();
|
||||
}
|
||||
cygthread (LPVOID_THREAD_START_ROUTINE start, unsigned n, LPVOID param, const char *name, HANDLE notify = NULL)
|
||||
cygthread (LPVOID_THREAD_START_ROUTINE start, unsigned n, LPVOID param, const char *name)
|
||||
: __name (name), func ((LPTHREAD_START_ROUTINE) start), arglen (n),
|
||||
arg (param), notify_detached (notify), standalone (true)
|
||||
arg (param), notify_detached (NULL)
|
||||
{
|
||||
create ();
|
||||
/* This is a neverending/high-priority thread */
|
||||
::SetThreadPriority (h, THREAD_PRIORITY_HIGHEST);
|
||||
zap_h ();
|
||||
QueueUserAPC (async_create, GetCurrentThread (), (ULONG_PTR) this);
|
||||
}
|
||||
cygthread () {};
|
||||
static void init ();
|
||||
|
|
|
@ -709,7 +709,7 @@ dll_crt0_0 ()
|
|||
/* Initialize signal processing here, early, in the hopes that the creation
|
||||
of a thread early in the process will cause more predictability in memory
|
||||
layout for the main thread. */
|
||||
if (!wincap.has_buggy_thread_startup () && !dynamically_loaded)
|
||||
if (!dynamically_loaded)
|
||||
sigproc_init ();
|
||||
|
||||
debug_printf ("finished dll_crt0_0 initialization");
|
||||
|
@ -724,8 +724,9 @@ dll_crt0_1 (void *)
|
|||
{
|
||||
extern void initial_setlocale ();
|
||||
|
||||
if (wincap.has_buggy_thread_startup () || dynamically_loaded)
|
||||
if (dynamically_loaded)
|
||||
sigproc_init ();
|
||||
|
||||
check_sanity_and_sync (user_data);
|
||||
|
||||
/* Initialize malloc and then call user_shared_initialize since it relies
|
||||
|
|
|
@ -47,7 +47,6 @@ wincaps wincap_2000 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||
has_broken_alloc_console:false,
|
||||
has_always_all_codepages:false,
|
||||
has_localenames:false,
|
||||
has_buggy_thread_startup:false,
|
||||
has_fast_cwd:false,
|
||||
has_restricted_raw_disk_access:false,
|
||||
use_dont_resolve_hack:false,
|
||||
|
@ -78,7 +77,6 @@ wincaps wincap_2000sp4 __attribute__((section (".cygwin_dll_common"), shared)) =
|
|||
has_broken_alloc_console:false,
|
||||
has_always_all_codepages:false,
|
||||
has_localenames:false,
|
||||
has_buggy_thread_startup:false,
|
||||
has_fast_cwd:false,
|
||||
has_restricted_raw_disk_access:false,
|
||||
use_dont_resolve_hack:false,
|
||||
|
@ -109,7 +107,6 @@ wincaps wincap_xp __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||
has_broken_alloc_console:false,
|
||||
has_always_all_codepages:false,
|
||||
has_localenames:false,
|
||||
has_buggy_thread_startup:false,
|
||||
has_fast_cwd:false,
|
||||
has_restricted_raw_disk_access:false,
|
||||
use_dont_resolve_hack:true,
|
||||
|
@ -140,7 +137,6 @@ wincaps wincap_xpsp1 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||
has_broken_alloc_console:false,
|
||||
has_always_all_codepages:false,
|
||||
has_localenames:false,
|
||||
has_buggy_thread_startup:false,
|
||||
has_fast_cwd:false,
|
||||
has_restricted_raw_disk_access:false,
|
||||
use_dont_resolve_hack:true,
|
||||
|
@ -171,7 +167,6 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||
has_broken_alloc_console:false,
|
||||
has_always_all_codepages:false,
|
||||
has_localenames:false,
|
||||
has_buggy_thread_startup:false,
|
||||
has_fast_cwd:false,
|
||||
has_restricted_raw_disk_access:false,
|
||||
use_dont_resolve_hack:true,
|
||||
|
@ -202,7 +197,6 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||
has_broken_alloc_console:false,
|
||||
has_always_all_codepages:false,
|
||||
has_localenames:false,
|
||||
has_buggy_thread_startup:false,
|
||||
has_fast_cwd:false,
|
||||
has_restricted_raw_disk_access:false,
|
||||
use_dont_resolve_hack:true,
|
||||
|
@ -233,7 +227,6 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||
has_broken_alloc_console:false,
|
||||
has_always_all_codepages:true,
|
||||
has_localenames:true,
|
||||
has_buggy_thread_startup:true,
|
||||
has_fast_cwd:true,
|
||||
has_restricted_raw_disk_access:true,
|
||||
use_dont_resolve_hack:false,
|
||||
|
@ -264,7 +257,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||
has_broken_alloc_console:true,
|
||||
has_always_all_codepages:true,
|
||||
has_localenames:true,
|
||||
has_buggy_thread_startup:false,
|
||||
has_fast_cwd:true,
|
||||
has_restricted_raw_disk_access:true,
|
||||
use_dont_resolve_hack:false,
|
||||
|
@ -358,8 +350,6 @@ wincapc::init ()
|
|||
((wincaps *)caps)->has_restricted_stack_args = false;
|
||||
}
|
||||
|
||||
if (!wow64)
|
||||
((wincaps *) caps)->has_buggy_thread_startup = false;
|
||||
__small_sprintf (osnam, "NT-%d.%d", version.dwMajorVersion,
|
||||
version.dwMinorVersion);
|
||||
}
|
||||
|
|
|
@ -37,7 +37,6 @@ struct wincaps
|
|||
unsigned has_broken_alloc_console : 1;
|
||||
unsigned has_always_all_codepages : 1;
|
||||
unsigned has_localenames : 1;
|
||||
unsigned has_buggy_thread_startup : 1;
|
||||
unsigned has_fast_cwd : 1;
|
||||
unsigned has_restricted_raw_disk_access : 1;
|
||||
unsigned use_dont_resolve_hack : 1;
|
||||
|
@ -87,7 +86,6 @@ public:
|
|||
bool IMPLEMENT (has_broken_alloc_console)
|
||||
bool IMPLEMENT (has_always_all_codepages)
|
||||
bool IMPLEMENT (has_localenames)
|
||||
bool IMPLEMENT (has_buggy_thread_startup)
|
||||
bool IMPLEMENT (has_fast_cwd)
|
||||
bool IMPLEMENT (has_restricted_raw_disk_access)
|
||||
bool IMPLEMENT (use_dont_resolve_hack)
|
||||
|
|
Loading…
Reference in New Issue