mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-03-02 13:05:42 +08:00
* 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>
|
2011-07-30 Christopher Faylor <me.cygwin2011@cgf.cx>
|
||||||
|
|
||||||
* fhandler.h (fhandler_base_overlapped::size): Declare/define size()
|
* fhandler.h (fhandler_base_overlapped::size): Declare/define size()
|
||||||
|
@ -186,6 +186,17 @@ out:
|
|||||||
return info;
|
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
|
void
|
||||||
cygthread::create ()
|
cygthread::create ()
|
||||||
{
|
{
|
||||||
|
@ -31,8 +31,8 @@ class cygthread
|
|||||||
bool is_freerange;
|
bool is_freerange;
|
||||||
static bool exiting;
|
static bool exiting;
|
||||||
HANDLE notify_detached;
|
HANDLE notify_detached;
|
||||||
bool standalone;
|
void create () __attribute__ ((regparm (1)));
|
||||||
void create () __attribute__ ((regparm(2)));
|
static void CALLBACK async_create (ULONG_PTR);
|
||||||
public:
|
public:
|
||||||
bool terminate_thread ();
|
bool terminate_thread ();
|
||||||
static DWORD WINAPI stub (VOID *);
|
static DWORD WINAPI stub (VOID *);
|
||||||
@ -44,33 +44,27 @@ class cygthread
|
|||||||
void release (bool);
|
void release (bool);
|
||||||
cygthread (LPTHREAD_START_ROUTINE start, unsigned n, LPVOID param, const char *name, HANDLE notify = NULL)
|
cygthread (LPTHREAD_START_ROUTINE start, unsigned n, LPVOID param, const char *name, HANDLE notify = NULL)
|
||||||
: __name (name), func (start), arglen (n), arg (param),
|
: __name (name), func (start), arglen (n), arg (param),
|
||||||
notify_detached (notify), standalone (false)
|
notify_detached (notify)
|
||||||
{
|
{
|
||||||
create ();
|
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),
|
: __name (name), func ((LPTHREAD_START_ROUTINE) start), arglen (0),
|
||||||
arg (param), notify_detached (notify), standalone (true)
|
arg (param), notify_detached (NULL)
|
||||||
{
|
{
|
||||||
create ();
|
QueueUserAPC (async_create, GetCurrentThread (), (ULONG_PTR) this);
|
||||||
/* This is a neverending/high-priority thread */
|
|
||||||
::SetThreadPriority (h, THREAD_PRIORITY_HIGHEST);
|
|
||||||
zap_h ();
|
|
||||||
}
|
}
|
||||||
cygthread (LPTHREAD_START_ROUTINE start, LPVOID param, const char *name, HANDLE notify = NULL)
|
cygthread (LPTHREAD_START_ROUTINE start, LPVOID param, const char *name, HANDLE notify = NULL)
|
||||||
: __name (name), func (start), arglen (0), arg (param),
|
: __name (name), func (start), arglen (0), arg (param),
|
||||||
notify_detached (notify), standalone (false)
|
notify_detached (notify)
|
||||||
{
|
{
|
||||||
create ();
|
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),
|
: __name (name), func ((LPTHREAD_START_ROUTINE) start), arglen (n),
|
||||||
arg (param), notify_detached (notify), standalone (true)
|
arg (param), notify_detached (NULL)
|
||||||
{
|
{
|
||||||
create ();
|
QueueUserAPC (async_create, GetCurrentThread (), (ULONG_PTR) this);
|
||||||
/* This is a neverending/high-priority thread */
|
|
||||||
::SetThreadPriority (h, THREAD_PRIORITY_HIGHEST);
|
|
||||||
zap_h ();
|
|
||||||
}
|
}
|
||||||
cygthread () {};
|
cygthread () {};
|
||||||
static void init ();
|
static void init ();
|
||||||
|
@ -709,7 +709,7 @@ dll_crt0_0 ()
|
|||||||
/* Initialize signal processing here, early, in the hopes that the creation
|
/* Initialize signal processing here, early, in the hopes that the creation
|
||||||
of a thread early in the process will cause more predictability in memory
|
of a thread early in the process will cause more predictability in memory
|
||||||
layout for the main thread. */
|
layout for the main thread. */
|
||||||
if (!wincap.has_buggy_thread_startup () && !dynamically_loaded)
|
if (!dynamically_loaded)
|
||||||
sigproc_init ();
|
sigproc_init ();
|
||||||
|
|
||||||
debug_printf ("finished dll_crt0_0 initialization");
|
debug_printf ("finished dll_crt0_0 initialization");
|
||||||
@ -724,8 +724,9 @@ dll_crt0_1 (void *)
|
|||||||
{
|
{
|
||||||
extern void initial_setlocale ();
|
extern void initial_setlocale ();
|
||||||
|
|
||||||
if (wincap.has_buggy_thread_startup () || dynamically_loaded)
|
if (dynamically_loaded)
|
||||||
sigproc_init ();
|
sigproc_init ();
|
||||||
|
|
||||||
check_sanity_and_sync (user_data);
|
check_sanity_and_sync (user_data);
|
||||||
|
|
||||||
/* Initialize malloc and then call user_shared_initialize since it relies
|
/* 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_broken_alloc_console:false,
|
||||||
has_always_all_codepages:false,
|
has_always_all_codepages:false,
|
||||||
has_localenames:false,
|
has_localenames:false,
|
||||||
has_buggy_thread_startup:false,
|
|
||||||
has_fast_cwd:false,
|
has_fast_cwd:false,
|
||||||
has_restricted_raw_disk_access:false,
|
has_restricted_raw_disk_access:false,
|
||||||
use_dont_resolve_hack: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_broken_alloc_console:false,
|
||||||
has_always_all_codepages:false,
|
has_always_all_codepages:false,
|
||||||
has_localenames:false,
|
has_localenames:false,
|
||||||
has_buggy_thread_startup:false,
|
|
||||||
has_fast_cwd:false,
|
has_fast_cwd:false,
|
||||||
has_restricted_raw_disk_access:false,
|
has_restricted_raw_disk_access:false,
|
||||||
use_dont_resolve_hack: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_broken_alloc_console:false,
|
||||||
has_always_all_codepages:false,
|
has_always_all_codepages:false,
|
||||||
has_localenames:false,
|
has_localenames:false,
|
||||||
has_buggy_thread_startup:false,
|
|
||||||
has_fast_cwd:false,
|
has_fast_cwd:false,
|
||||||
has_restricted_raw_disk_access:false,
|
has_restricted_raw_disk_access:false,
|
||||||
use_dont_resolve_hack:true,
|
use_dont_resolve_hack:true,
|
||||||
@ -140,7 +137,6 @@ wincaps wincap_xpsp1 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||||||
has_broken_alloc_console:false,
|
has_broken_alloc_console:false,
|
||||||
has_always_all_codepages:false,
|
has_always_all_codepages:false,
|
||||||
has_localenames:false,
|
has_localenames:false,
|
||||||
has_buggy_thread_startup:false,
|
|
||||||
has_fast_cwd:false,
|
has_fast_cwd:false,
|
||||||
has_restricted_raw_disk_access:false,
|
has_restricted_raw_disk_access:false,
|
||||||
use_dont_resolve_hack:true,
|
use_dont_resolve_hack:true,
|
||||||
@ -171,7 +167,6 @@ wincaps wincap_xpsp2 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||||||
has_broken_alloc_console:false,
|
has_broken_alloc_console:false,
|
||||||
has_always_all_codepages:false,
|
has_always_all_codepages:false,
|
||||||
has_localenames:false,
|
has_localenames:false,
|
||||||
has_buggy_thread_startup:false,
|
|
||||||
has_fast_cwd:false,
|
has_fast_cwd:false,
|
||||||
has_restricted_raw_disk_access:false,
|
has_restricted_raw_disk_access:false,
|
||||||
use_dont_resolve_hack:true,
|
use_dont_resolve_hack:true,
|
||||||
@ -202,7 +197,6 @@ wincaps wincap_2003 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||||||
has_broken_alloc_console:false,
|
has_broken_alloc_console:false,
|
||||||
has_always_all_codepages:false,
|
has_always_all_codepages:false,
|
||||||
has_localenames:false,
|
has_localenames:false,
|
||||||
has_buggy_thread_startup:false,
|
|
||||||
has_fast_cwd:false,
|
has_fast_cwd:false,
|
||||||
has_restricted_raw_disk_access:false,
|
has_restricted_raw_disk_access:false,
|
||||||
use_dont_resolve_hack:true,
|
use_dont_resolve_hack:true,
|
||||||
@ -233,7 +227,6 @@ wincaps wincap_vista __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||||||
has_broken_alloc_console:false,
|
has_broken_alloc_console:false,
|
||||||
has_always_all_codepages:true,
|
has_always_all_codepages:true,
|
||||||
has_localenames:true,
|
has_localenames:true,
|
||||||
has_buggy_thread_startup:true,
|
|
||||||
has_fast_cwd:true,
|
has_fast_cwd:true,
|
||||||
has_restricted_raw_disk_access:true,
|
has_restricted_raw_disk_access:true,
|
||||||
use_dont_resolve_hack:false,
|
use_dont_resolve_hack:false,
|
||||||
@ -264,7 +257,6 @@ wincaps wincap_7 __attribute__((section (".cygwin_dll_common"), shared)) = {
|
|||||||
has_broken_alloc_console:true,
|
has_broken_alloc_console:true,
|
||||||
has_always_all_codepages:true,
|
has_always_all_codepages:true,
|
||||||
has_localenames:true,
|
has_localenames:true,
|
||||||
has_buggy_thread_startup:false,
|
|
||||||
has_fast_cwd:true,
|
has_fast_cwd:true,
|
||||||
has_restricted_raw_disk_access:true,
|
has_restricted_raw_disk_access:true,
|
||||||
use_dont_resolve_hack:false,
|
use_dont_resolve_hack:false,
|
||||||
@ -358,8 +350,6 @@ wincapc::init ()
|
|||||||
((wincaps *)caps)->has_restricted_stack_args = false;
|
((wincaps *)caps)->has_restricted_stack_args = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!wow64)
|
|
||||||
((wincaps *) caps)->has_buggy_thread_startup = false;
|
|
||||||
__small_sprintf (osnam, "NT-%d.%d", version.dwMajorVersion,
|
__small_sprintf (osnam, "NT-%d.%d", version.dwMajorVersion,
|
||||||
version.dwMinorVersion);
|
version.dwMinorVersion);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,6 @@ struct wincaps
|
|||||||
unsigned has_broken_alloc_console : 1;
|
unsigned has_broken_alloc_console : 1;
|
||||||
unsigned has_always_all_codepages : 1;
|
unsigned has_always_all_codepages : 1;
|
||||||
unsigned has_localenames : 1;
|
unsigned has_localenames : 1;
|
||||||
unsigned has_buggy_thread_startup : 1;
|
|
||||||
unsigned has_fast_cwd : 1;
|
unsigned has_fast_cwd : 1;
|
||||||
unsigned has_restricted_raw_disk_access : 1;
|
unsigned has_restricted_raw_disk_access : 1;
|
||||||
unsigned use_dont_resolve_hack : 1;
|
unsigned use_dont_resolve_hack : 1;
|
||||||
@ -87,7 +86,6 @@ public:
|
|||||||
bool IMPLEMENT (has_broken_alloc_console)
|
bool IMPLEMENT (has_broken_alloc_console)
|
||||||
bool IMPLEMENT (has_always_all_codepages)
|
bool IMPLEMENT (has_always_all_codepages)
|
||||||
bool IMPLEMENT (has_localenames)
|
bool IMPLEMENT (has_localenames)
|
||||||
bool IMPLEMENT (has_buggy_thread_startup)
|
|
||||||
bool IMPLEMENT (has_fast_cwd)
|
bool IMPLEMENT (has_fast_cwd)
|
||||||
bool IMPLEMENT (has_restricted_raw_disk_access)
|
bool IMPLEMENT (has_restricted_raw_disk_access)
|
||||||
bool IMPLEMENT (use_dont_resolve_hack)
|
bool IMPLEMENT (use_dont_resolve_hack)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user