diff options
author | Christopher Faylor <me@cgf.cx> | 2003-12-12 04:15:32 +0000 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2003-12-12 04:15:32 +0000 |
commit | c76d70d7c04797ab9c24ae134d602b78d201b052 (patch) | |
tree | 3f6a9cee5f9f8b91a60445bea53eab83f686bef8 | |
parent | 97cb9b9de404248a3c117a2f391696732ce6e860 (diff) | |
download | newlib-c76d70d7c04797ab9c24ae134d602b78d201b052.zip newlib-c76d70d7c04797ab9c24ae134d602b78d201b052.tar.gz newlib-c76d70d7c04797ab9c24ae134d602b78d201b052.tar.bz2 |
* miscfuncs.cc (low_priority_sleep): Correct thinko which caused SetPriority to
be called unnecessarily.
* thread.cc (pthread::init_main_thread): Call new create_cancel_event function.
(pthread::precreate): Ditto.
(pthread::postcreate): Remove cancel_event creation.
(pthread::create_cancel_event): Define new function.
* thread.h (pthread::create_cancel_event): Declare new function.
-rw-r--r-- | winsup/cygwin/ChangeLog | 21 | ||||
-rw-r--r-- | winsup/cygwin/miscfuncs.cc | 2 | ||||
-rw-r--r-- | winsup/cygwin/thread.cc | 25 | ||||
-rw-r--r-- | winsup/cygwin/thread.h | 1 |
4 files changed, 34 insertions, 15 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 3d1cab7..8cc59fd 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,14 @@ +2003-12-11 Christopher Faylor <cgf@redhat.com> + + * miscfuncs.cc (low_priority_sleep): Correct thinko which caused + SetPriority to be called unnecessarily. + * thread.cc (pthread::init_main_thread): Call new create_cancel_event + function. + (pthread::precreate): Ditto. + (pthread::postcreate): Remove cancel_event creation. + (pthread::create_cancel_event): Define new function. + * thread.h (pthread::create_cancel_event): Declare new function. + 2003-12-11 Brian Ford <ford@vss.fsi.com> * fhandler_serial.cc (fhandler_serial::tcflush): Simplify. Remove @@ -194,7 +205,7 @@ 2003-12-03 Corinna Vinschen <corinna@vinschen.de> * fhandler_disk_file.cc (fhandler_disk_file::lock): Use UINT32_MAX - instead of 0xffffffff. Accomodate Win 9x bug in evaluating length + instead of 0xffffffff. Accommodate Win 9x bug in evaluating length of area to lock when given length is 0. 2003-12-03 Pierre Humblet <pierre.humblet@ieee.org> @@ -276,7 +287,7 @@ struct __flock64 *. * fhandler_disk_file.cc (fhandler_disk_file::lock): Ditto. Rework to be 64 bit aware. - * fhandler.h: Accomodate above method argument changes. + * fhandler.h: Accommodate above method argument changes. * include/cygwin/types.h: Add struct __flock32 and __flock64. Define struct flock according to setting of __CYGWIN_USE_BIG_TYPES__. * include/cygwin/version.h: Bump API minor number. @@ -876,7 +887,7 @@ Use appropriate security attribute for process shared semaphores. (semaphore::semaphore): New constructor for named semaphores. (semaphore::~semaphore): Care for semaphore name. - (semaphore::_post): Accomodate failing ReleaseSemaphore. Use value + (semaphore::_post): Accommodate failing ReleaseSemaphore. Use value returned by ReleaseSemaphore vor currentvalue. (semaphore::_getvalue): New method. (semaphore::_timedwait): Ditto. @@ -1612,7 +1623,7 @@ orig_gid to saved_psid, saved_uid and saved_gid respectively. Rename methods orig_sid and set_orig_sid to saved_sid and set_saved_sid respectively. - * sec_helper.cc (sec_acl): Accomodate above changes. + * sec_helper.cc (sec_acl): Accommodate above changes. * spawn.cc (spawn_guts): Ditto. * uinfo.cc (uinfo_init): Ditto. @@ -1972,7 +1983,7 @@ * mmap.cc: Restructure. Add, remove and rewrite comments throughout for better readability. Change function names for better understanding. - (MAP_SET): Accomodate name change from map_map_ to page_map_. + (MAP_SET): Accommodate name change from map_map_ to page_map_. (MAP_CLR): Ditto. (MAP_ISSET): Ditto. (mmap_record::page_map_): Rename from page_map_. diff --git a/winsup/cygwin/miscfuncs.cc b/winsup/cygwin/miscfuncs.cc index 8d0c5b3..37ef3a4 100644 --- a/winsup/cygwin/miscfuncs.cc +++ b/winsup/cygwin/miscfuncs.cc @@ -334,7 +334,7 @@ low_priority_sleep (DWORD secs) SetThreadPriority (thisthread, new_prio); Sleep (secs); - if (!staylow || curr_prio == new_prio) + if (!staylow && curr_prio != new_prio) SetThreadPriority (thisthread, curr_prio); } diff --git a/winsup/cygwin/thread.cc b/winsup/cygwin/thread.cc index a6b2f99..b2ba543 100644 --- a/winsup/cygwin/thread.cc +++ b/winsup/cygwin/thread.cc @@ -233,6 +233,7 @@ pthread::init_mainthread () 0, FALSE, DUPLICATE_SAME_ACCESS)) thread->win32_obj_id = NULL; thread->set_tls_self_pointer (); + (void) thread->create_cancel_event (); thread->postcreate (); } @@ -282,6 +283,19 @@ pthread::~pthread () threads.remove (this); } +bool +pthread::create_cancel_event () +{ + cancel_event = ::CreateEvent (&sec_none_nih, TRUE, FALSE, NULL); + if (!cancel_event) + { + system_printf ("couldn't create cancel event for main thread, %E"); + /* we need the event for correct behaviour */ + return false; + } + return true; +} + void pthread::precreate (pthread_attr *newattr) { @@ -308,6 +322,8 @@ pthread::precreate (pthread_attr *newattr) } /* Change the mutex type to NORMAL to speed up mutex operations */ mutex.type = PTHREAD_MUTEX_NORMAL; + if (!create_cancel_event ()) + magic = 0; } void @@ -340,15 +356,6 @@ pthread::create (void *(*func) (void *), pthread_attr *newattr, void pthread::postcreate () { - cancel_event = ::CreateEvent (&sec_none_nih, TRUE, FALSE, NULL); - if (!cancel_event) - { - system_printf ("couldn't create cancel event for main thread, %E"); - /* we need the event for correct behaviour */ - magic = 0; - return; - } - valid = true; InterlockedIncrement (&MT_INTERFACE->threadcount); diff --git a/winsup/cygwin/thread.h b/winsup/cygwin/thread.h index ef0e59a..e530a64 100644 --- a/winsup/cygwin/thread.h +++ b/winsup/cygwin/thread.h @@ -545,6 +545,7 @@ private: void precreate (pthread_attr *); void postcreate (); void set_tls_self_pointer (); + bool create_cancel_event (); static pthread *get_tls_self_pointer (); void cancel_self (); DWORD get_thread_id (); |