Skip to content

Commit

Permalink
PHPEMBED: init lock needs to last longer
Browse files Browse the repository at this point in the history
Summary: if it didn't, a race condition could cause one host to try to use the
interpreter before it was ready

Reviewed By: dreiss

Test Plan: ran the worker for a subset




git-svn-id: svn+ssh://tubbs/svnroot/projects/phpembed/trunk@68715 2c7ba8d8-a2f7-0310-a573-de162e16dcc7
  • Loading branch information
boz committed Nov 8, 2007
1 parent 449d6f9 commit 99736a1
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/php_cxx.cpp
Expand Up @@ -997,10 +997,10 @@ int php::init_global_php(){
#ifdef ZTS
tsrm_mutex_lock(p.init_lock);
p.clients++;
if(p.initialized == true)
if(p.initialized == true){
tsrm_mutex_unlock(p.init_lock);
return SUCCESS;
p.initialized = true;
tsrm_mutex_unlock(p.init_lock);
}
#endif

// set up the callbacks
Expand Down Expand Up @@ -1055,6 +1055,11 @@ int php::init_global_php(){

zend_llist_init(&global_vars, sizeof(char *), NULL, 0);

#ifdef ZTS
p.initialized = true;
tsrm_mutex_unlock(p.init_lock);
#endif

return SUCCESS;
// END ADAPTED php_embed_init
}
Expand Down

0 comments on commit 99736a1

Please sign in to comment.