* dcrt0.cc (child_info_fork::alloc_stack_hard_way): Change sense of guard test.
Increase size of stack reserved and increase size before the current stack pointer. Use pointers when doing arithmetic. (dll_crt0_1): Initialize exception handler when we notice we're the child of a fork from non-main thread. * fork.cc (frok::parent): Make argument volatile. (frok::child): Ditto. (lock_signals): New class. (lock_pthread): Ditto. (hold_everhthing): Ditto. (frok::parent): Move atforkprepare and atforkparent to lock_pthread class. (fork): Make ischild boolean. Use hold_everything variable within limited scope to set various mutexes in such a way as to avoid deadlocks. * thread.h (pthread_mutex::tid): New variable, active when debugging for tracking thread id of owner. (pthread_mutex::set_owner): Set tid when debugging. * thread.cc (pthread_mutex::pthread_mutex): Clear tid. (pthread_mutex::_unlock): Ditto when unlocking. (pthread_mutex::fixup_after_fork): Set tid to special value after forking since owner is unknown.
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
/* thread.h: Locking and threading module definitions
|
||||
|
||||
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2007 Red Hat, Inc.
|
||||
|
||||
Written by Marco Fuykschot <marco@ddi.nl>
|
||||
Major update 2001 Robert Collins <rbtcollins@hotmail.com>
|
||||
Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007 Red Hat, Inc.
|
||||
|
||||
This file is part of Cygwin.
|
||||
|
||||
@@ -45,7 +42,8 @@ void ReleaseResourceLock (int, int, const char *)
|
||||
__attribute__ ((regparm (3)));
|
||||
}
|
||||
|
||||
DWORD cancelable_wait (HANDLE, DWORD, const cw_cancel_action = cw_cancel_self, const enum cw_sig_wait = cw_sig_nosig)
|
||||
DWORD cancelable_wait (HANDLE, DWORD, const cw_cancel_action = cw_cancel_self,
|
||||
const enum cw_sig_wait = cw_sig_nosig)
|
||||
__attribute__ ((regparm (3)));
|
||||
|
||||
class fast_mutex
|
||||
@@ -298,6 +296,9 @@ public:
|
||||
unsigned int recursion_counter;
|
||||
LONG condwaits;
|
||||
pthread_t owner;
|
||||
#ifdef DEBUGGING
|
||||
DWORD tid; /* the thread id of the owner */
|
||||
#endif
|
||||
int type;
|
||||
int pshared;
|
||||
|
||||
@@ -328,6 +329,9 @@ public:
|
||||
{
|
||||
recursion_counter = 1;
|
||||
owner = self;
|
||||
#ifdef DEBUGGING
|
||||
tid = GetCurrentThreadId ();
|
||||
#endif
|
||||
}
|
||||
|
||||
int lock_recursive ()
|
||||
|
Reference in New Issue
Block a user