Re: [PHP4BETA] deadlock

From: Date: Sat, 25 Sep 1999 10:47:22 +0000
Subject: Re: [PHP4BETA] deadlock
References: 1 2  Groups: php.version4 
Request: Send a blank email to php-version4+get-4896@lists.php.net to get a copy of this message
On Sat, Sep 25, 1999 at 12:37:12PM +0200, Andi Gutmans wrote: > Hi, > > I think the .ctor in allocate_new_resource is the problem which is causing > it. It should probably not be mutexed. I'm not sure about the > tsrm_new_thread_(begin/end)_handlers handlers though. > Try and unlock the mutex call in TSRM.c before line 191 and re-lock it > after that line. Since the deadlock was happening when tsrm_new_thread_begin_handler() was called, I've also added unlock/lock pairs around begin_handler and end_handler. Now, the deadlock does not happen anymore. Btw, CVS on cvs.zend.com times out currently. -- Regards, Sascha Schumann Consultant

--- ../TSRM/TSRM.c Tue Aug 17 19:54:16 1999 +++ TSRM.cc Sat Sep 25 12:46:32 1999 @@ -177,7 +177,9 @@ int i; if (tsrm_new_thread_begin_handler) { + tsrm_mutex_unlock(tsmm_mutex); tsrm_new_thread_begin_handler(thread_id); + tsrm_mutex_lock(tsmm_mutex); } (*thread_resources_ptr) = (tsrm_tls_entry *) malloc(sizeof(tsrm_tls_entry)); @@ -188,11 +190,15 @@ for (i=0; i<id_count; i++) { (*thread_resources_ptr)->storage[i] = (void *) malloc(resource_types_table[i].size); if (resource_types_table[i].ctor) { + tsrm_mutex_unlock(tsmm_mutex); resource_types_table[i].ctor((*thread_resources_ptr)->storage[i]); + tsrm_mutex_lock(tsmm_mutex); } } if (tsrm_new_thread_end_handler) { + tsrm_mutex_unlock(tsmm_mutex); tsrm_new_thread_end_handler(thread_id); + tsrm_mutex_lock(tsmm_mutex); } }
« previous php.version4 (#4896) next »