diff options
author | Conrad Scott <conrad.scott@dsl.pipex.com> | 2002-07-09 16:01:02 +0400 |
---|---|---|
committer | Conrad Scott <conrad.scott@dsl.pipex.com> | 2002-07-09 16:01:02 +0400 |
commit | b1db114f6428cbe415fbb1401f85cafb1b6a7aa0 (patch) | |
tree | 7a66b713094562ddc04e18ca19c101299caaf8cb | |
parent | 1ae9edf57c250f7779496e789c1cfaad230dd77f (diff) |
Merged changes from HEAD
-rw-r--r-- | winsup/cygwin/ChangeLog | 52 | ||||
-rw-r--r-- | winsup/cygwin/debug.cc | 35 | ||||
-rw-r--r-- | winsup/cygwin/fork.cc | 5 |
3 files changed, 82 insertions, 10 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 8f8c20161..57d5cbcda 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,3 +1,12 @@ +2002-07-09 Christopher Faylor <cgf@redhat.com> + + * debug.cc: Avoid explicit zeroing of globals. + (lock_debug): Make locker a static member. Avoid unlocking when + already unlocked (from Conrad Scott). + (debug_init): Initialize lock_debug::locker here. + * fork.cc (fork_child): Fix up fdtab earlier to avoid some (but not + all) confusion with close-on-exec craziness. + 2002-07-05 Corinna Vinschen <corinna@vinschen.de> * fhandler.h (fhandler_socket::is_unconnected): Constify. @@ -749,6 +758,49 @@ * include/cygwin/version.h: Bump DLL minor number. +2002-06-25 Thomas Pfaff <tpfaff@gmx.net> + + * include/pthread.h (PTHREAD_CANCELED): Defined a reasonable + value. + * pthread.cc (pthread_exit): Call method instead of function. + (pthread_setcancelstate): Ditto. + (pthread_setcanceltype): Ditto. + (pthread_testcancel): Ditto. + * thread.h (pthread::cancel_event): New member. + (__pthread_cancel_self): New prototype. + (pthread::exit): New Method. + (pthread::cancel): Ditto. + (pthread::testcancel): Ditto. + (pthread::cancel_self): Ditto. + (pthread::static_cancel_self): Ditto. + (pthread::setcancelstate): Ditto. + (pthread::setcanceltype): Ditto. + (__pthread_cancel): Give c++ linkage. + (__pthread_exit): Remove. + (__pthread_setcancelstate): Ditto. + (__pthread_setcanceltype): Ditto. + (__pthread_testcancel): Ditto. + * thread.cc (pthread::pthread): Inititialize cancel_event. + (pthread::~pthread): Close cancel_event if needed. + (pthread::create): Create cancel_event. + (pthread::exit): New method. Replacement for __pthread_exit. + (pthread::cancel): New method. + (pthread::testcancel): Ditto. + (pthread::static_cancel_self); New static method. + (pthread::setcancelstate): New method. Replacement for + __pthread_setcancelstate. + (pthread::setcanceltype): New method. Replacement for + __pthread_setcanceltype. + (pthread::pop_cleanup_handler): Added lock for async cancel safe + cancellation. + (pthread::thread_init_wrapper): Change __pthread_exit to + thread->exit(). + (__pthread_cancel): Call method thread->cancel(). + (__pthread_exit): Remove. + (__pthread_setcancelstate): Ditto. + (__pthread_setcanceltype): Ditto. + (__pthread_testcancel): Ditto. + 2002-06-25 Christopher Faylor <cgf@redhat.com> * dcrt0.cc (sm): Make NO_COPY. diff --git a/winsup/cygwin/debug.cc b/winsup/cygwin/debug.cc index a530c5c34..dc786ff69 100644 --- a/winsup/cygwin/debug.cc +++ b/winsup/cygwin/debug.cc @@ -176,27 +176,45 @@ typedef struct _h struct _h *next; } handle_list; -static NO_COPY handle_list starth = {0, NULL, NULL, NULL, 0, 0, NULL}; -static NO_COPY handle_list *endh = NULL; +static NO_COPY handle_list starth; +static NO_COPY handle_list *endh; -static handle_list NO_COPY freeh[1000] = {{0, NULL, NULL, NULL, 0, 0, NULL}}; +static NO_COPY handle_list freeh[1000]; #define NFREEH (sizeof (freeh) / sizeof (freeh[0])) -static muto NO_COPY *debug_lock = NULL; +void debug_init (); -struct lock_debug +class lock_debug { - lock_debug () {if (debug_lock) debug_lock->acquire (INFINITE);} - void unlock () {if (debug_lock) debug_lock->release ();} + static muto *locker; + bool acquired; + public: + lock_debug () : acquired (0) + { + if (locker) + acquired = !!locker->acquire (INFINITE); + } + void unlock () + { + if (locker && acquired) + { + locker->release (); + acquired = false; + } + } ~lock_debug () {unlock ();} + friend void debug_init (); }; +muto NO_COPY *lock_debug::locker = NULL; + static bool __stdcall mark_closed (const char *, int, HANDLE, const char *, BOOL); void debug_init () { - new_muto (debug_lock); + muto *debug_lock_muto; + lock_debug::locker = new_muto (debug_lock_muto); } /* Find a registered handle in the linked list of handles. */ @@ -296,6 +314,7 @@ delete_handle (handle_list *hl) void debug_fixup_after_fork () { + /* No lock needed at this point */ handle_list *hl; for (hl = &starth; hl->next != NULL; hl = hl->next) if (hl->next->clexec_pid) diff --git a/winsup/cygwin/fork.cc b/winsup/cygwin/fork.cc index e6fb91037..e25bc478c 100644 --- a/winsup/cygwin/fork.cc +++ b/winsup/cygwin/fork.cc @@ -243,7 +243,6 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls) } sync_with_parent ("after longjmp.", TRUE); - ProtectHandle (hParent); sigproc_printf ("hParent %p, child 1 first_dll %p, load_dlls %d\n", hParent, first_dll, load_dlls); @@ -275,9 +274,11 @@ fork_child (HANDLE& hParent, dll *&first_dll, bool& load_dlls) MALLOC_CHECK; + cygheap->fdtab.fixup_after_fork (hParent); + ProtectHandle (hParent); + debug_fixup_after_fork (); pinfo_fixup_after_fork (); - cygheap->fdtab.fixup_after_fork (hParent); signal_fixup_after_fork (); MALLOC_CHECK; |