mirror of
https://github.com/php/php-src.git
synced 2025-08-19 08:49:28 +02:00
Sync with bzr
This commit is contained in:
parent
6cf169b16c
commit
73dfa53ca8
6 changed files with 94 additions and 62 deletions
|
@ -172,7 +172,7 @@ MYSQLND_THD_ZVAL_PCACHE* _mysqlnd_palloc_get_thd_cache_reference(MYSQLND_THD_ZVA
|
|||
if (cache) {
|
||||
++cache->references;
|
||||
DBG_INF_FMT("cache=%p new_refc=%d gc_list.canary1=%p gc_list.canary2=%p",
|
||||
*cache, cache->references, cache->gc_list.canary1, cache->gc_list.canary2);
|
||||
cache, cache->references, cache->gc_list.canary1, cache->gc_list.canary2);
|
||||
mysqlnd_palloc_get_cache_reference(cache->parent);
|
||||
}
|
||||
DBG_RETURN(cache);
|
||||
|
@ -189,13 +189,43 @@ MYSQLND_THD_ZVAL_PCACHE* _mysqlnd_palloc_get_thd_cache_reference(MYSQLND_THD_ZVA
|
|||
constructor of the cache.
|
||||
*/
|
||||
static
|
||||
void mysqlnd_palloc_free_thd_cache(MYSQLND_THD_ZVAL_PCACHE *cache TSRMLS_DC)
|
||||
void mysqlnd_palloc_free_thd_cache(MYSQLND_THD_ZVAL_PCACHE *thd_cache TSRMLS_DC)
|
||||
{
|
||||
DBG_ENTER("mysqlnd_palloc_free_thd_cache");
|
||||
DBG_INF_FMT("cache=%p", cache);
|
||||
MYSQLND_ZVAL_PCACHE *global_cache;
|
||||
mysqlnd_zval **p;
|
||||
|
||||
mnd_free(cache->gc_list.ptr_line);
|
||||
mnd_free(cache);
|
||||
DBG_ENTER("mysqlnd_palloc_free_thd_cache");
|
||||
DBG_INF_FMT("thd_cache=%p", thd_cache);
|
||||
|
||||
if ((global_cache = thd_cache->parent)) {
|
||||
/*
|
||||
Keep in mind that for pthreads pthread_equal() should be used to be
|
||||
fully standard compliant. However, the PHP code all-around, incl. the
|
||||
the Zend MM uses direct comparison.
|
||||
*/
|
||||
p = thd_cache->gc_list.ptr_line;
|
||||
while (p < thd_cache->gc_list.last_added) {
|
||||
zval_dtor(&(*p)->zv);
|
||||
p++;
|
||||
}
|
||||
|
||||
p = thd_cache->gc_list.ptr_line;
|
||||
|
||||
LOCK_PCACHE(global_cache);
|
||||
while (p < thd_cache->gc_list.last_added) {
|
||||
(*p)->point_type = MYSQLND_POINTS_FREE;
|
||||
*(--global_cache->free_list.last_added) = *p;
|
||||
++global_cache->free_items;
|
||||
#ifdef ZTS
|
||||
memset(&((*p)->thread_id), 0, sizeof(THREAD_T));
|
||||
#endif
|
||||
p++;
|
||||
}
|
||||
UNLOCK_PCACHE(global_cache);
|
||||
|
||||
}
|
||||
mnd_free(thd_cache->gc_list.ptr_line);
|
||||
mnd_free(thd_cache);
|
||||
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
|
@ -508,43 +538,9 @@ PHPAPI MYSQLND_THD_ZVAL_PCACHE * _mysqlnd_palloc_rinit(MYSQLND_ZVAL_PCACHE * cac
|
|||
/* {{{ _mysqlnd_palloc_rshutdown */
|
||||
PHPAPI void _mysqlnd_palloc_rshutdown(MYSQLND_THD_ZVAL_PCACHE * thd_cache TSRMLS_DC)
|
||||
{
|
||||
MYSQLND_ZVAL_PCACHE *cache;
|
||||
mysqlnd_zval **p;
|
||||
|
||||
DBG_ENTER("_mysqlnd_palloc_rshutdown");
|
||||
DBG_INF_FMT("cache=%p", thd_cache);
|
||||
|
||||
if (!thd_cache || !(cache = thd_cache->parent)) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
Keep in mind that for pthreads pthread_equal() should be used to be
|
||||
fully standard compliant. However, the PHP code all-around, incl. the
|
||||
the Zend MM uses direct comparison.
|
||||
*/
|
||||
p = thd_cache->gc_list.ptr_line;
|
||||
while (p < thd_cache->gc_list.last_added) {
|
||||
zval_dtor(&(*p)->zv);
|
||||
p++;
|
||||
}
|
||||
|
||||
p = thd_cache->gc_list.ptr_line;
|
||||
|
||||
LOCK_PCACHE(cache);
|
||||
while (p < thd_cache->gc_list.last_added) {
|
||||
(*p)->point_type = MYSQLND_POINTS_FREE;
|
||||
*(--cache->free_list.last_added) = *p;
|
||||
++cache->free_items;
|
||||
#ifdef ZTS
|
||||
memset(&((*p)->thread_id), 0, sizeof(THREAD_T));
|
||||
#endif
|
||||
p++;
|
||||
}
|
||||
UNLOCK_PCACHE(cache);
|
||||
|
||||
mysqlnd_palloc_free_thd_cache_reference(&thd_cache);
|
||||
|
||||
DBG_VOID_RETURN;
|
||||
}
|
||||
/* }}} */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue