예제 #1
0
ZEND_API void zend_ts_hash_destroy(TsHashTable *ht)
{
#ifdef ZTS
	tsrm_mutex_free(ht->mx_reader);
	tsrm_mutex_free(ht->mx_writer);
#endif
	zend_hash_destroy(TS_HASH(ht));
}
예제 #2
0
ZEND_API void zend_ts_hash_graceful_destroy(TsHashTable *ht)
{
	begin_write(ht);
	zend_hash_graceful_destroy(TS_HASH(ht));
	end_write(ht);

#ifdef ZTS
	tsrm_mutex_free(ht->mx_reader);
	tsrm_mutex_free(ht->mx_reader);
#endif
}
예제 #3
0
/* on merge: added function */
void mkd_tags_on_shutdown(SHUTDOWN_FUNC_ARGS)
{
	mkd_shlib_destructor();
#ifdef ZTS
	tsrm_mutex_free(tags_mutex);
#endif
}
예제 #4
0
파일: xc_mutex.c 프로젝트: lighttpd/xcache
/* }}} */
void xc_mutex_destroy(xc_mutex_t *mutex) /* {{{ */
{
	assert(mutex);

	/* intended to not destroy mutex when mutex is shared between process */
	if (!mutex->shared) {
#ifdef XC_MUTEX_USE_PTHREAD
		pthread_mutex_destroy(&mutex->pthread_mutex);
#endif

#ifdef XC_MUTEX_USE_TSRM
		tsrm_mutex_free(mutex->tsrm_mutex);
#endif
	}

#ifdef XC_MUTEX_USE_FCNTL
	if (xc_want_inter_process()) {
		xc_fcntl_destroy(&mutex->fcntl_mutex);
	}
#endif

	if (!mutex->shared) {
		free(mutex);
	}
}
예제 #5
0
파일: reentrancy.c 프로젝트: SammyK/php-src
void reentrancy_shutdown(void)
{
	int i;

	for (i = 0; i < NUMBER_OF_LOCKS; i++) {
		tsrm_mutex_free(reentrant_locks[i]);
	}
}
예제 #6
0
파일: sendrecvmsg.c 프로젝트: 20uf/php-src
void php_socket_sendrecvmsg_shutdown(SHUTDOWN_FUNC_ARGS)
{
#ifdef ZTS
	tsrm_mutex_free(ancillary_mutex);
#endif

	destroy_ancillary_registry();
}
예제 #7
0
파일: TSRM.c 프로젝트: daniel-higa/php-src
/* Shutdown TSRM (call once for the entire process) */
TSRM_API void tsrm_shutdown(void)
{/*{{{*/
	int i;

	if (!in_main_thread) {
		/* ensure singleton */
		return;
	}

	if (tsrm_tls_table) {
		for (i=0; i<tsrm_tls_table_size; i++) {
			tsrm_tls_entry *p = tsrm_tls_table[i], *next_p;

			while (p) {
				int j;

				next_p = p->next;
				for (j=0; j<p->count; j++) {
					if (p->storage[j]) {
						if (resource_types_table && !resource_types_table[j].done && resource_types_table[j].dtor) {
							resource_types_table[j].dtor(p->storage[j]);
						}
						free(p->storage[j]);
					}
				}
				free(p->storage);
				free(p);
				p = next_p;
			}
		}
		free(tsrm_tls_table);
		tsrm_tls_table = NULL;
	}
	if (resource_types_table) {
		free(resource_types_table);
		resource_types_table=NULL;
	}
	tsrm_mutex_free(tsmm_mutex);
	tsmm_mutex = NULL;
	TSRM_ERROR((TSRM_ERROR_LEVEL_CORE, "Shutdown TSRM"));
	if (tsrm_error_file!=stderr) {
		fclose(tsrm_error_file);
	}
#if defined(GNUPTH)
	pth_kill();
#elif defined(PTHREADS)
	pthread_setspecific(tls_key, 0);
	pthread_key_delete(tls_key);
#elif defined(TSRM_WIN32)
	TlsFree(tls_key);
#endif
	if (tsrm_shutdown_handler) {
		tsrm_shutdown_handler();
	}
	tsrm_new_thread_begin_handler = NULL;
	tsrm_new_thread_end_handler = NULL;
	tsrm_shutdown_handler = NULL;
}/*}}}*/
예제 #8
0
파일: winutil.c 프로젝트: Doap/php-src
void php_win32_free_rng_lock()
{
	tsrm_mutex_lock(php_lock_win32_cryptoctx);
	CryptReleaseContext(hCryptProv, 0);
	has_crypto_ctx = 0;
	tsrm_mutex_unlock(php_lock_win32_cryptoctx);
	tsrm_mutex_free(php_lock_win32_cryptoctx);

}
예제 #9
0
void thr_close_rwlock(THR_RW_LOCK *rwlock)
{
#ifdef TSRM_WIN32
	tsrm_mutex_free(rwlock->lock);
	thr_close_event(rwlock->event);
#elif defined(PTHREADS)
	pthread_mutex_destroy(rwlock->lock);
	thr_close_event(rwlock->event);
	free(rwlock->lock);
#else
#endif
	free(rwlock);
}
예제 #10
0
/*
  As this call will happen on MSHUTDOWN(), then we don't need to copy the zvals with
  copy_ctor but scrap what they point to with zval_dtor() and then just free our
  pre-allocated block. Precondition is that we ZVAL_NULL() the zvals when we put them
  to the free list after usage. We ZVAL_NULL() them when we allocate them in the 
  constructor of the cache.
*/
static
void mysqlnd_qcache_free_cache(MYSQLND_QCACHE *cache)
{
#ifndef MYSQLND_SILENT
	php_printf("[mysqlnd_qcache_free_cache %p]\n", cache);
#endif

#ifdef ZTS
	tsrm_mutex_free(cache->LOCK_access);
#endif
	zend_hash_destroy(cache->ht);
	free(cache->ht);
	free(cache);
}
예제 #11
0
void backtrace_zts_shutdown(TSRMLS_D)
{
#ifdef DEBUG
	fprintf(stderr, "[%d]: backtrace_zts_shutdown()\n", getpid());
	fflush(stderr);
#endif

	tsrm_set_new_thread_end_handler(thread_end_func);
	tsrm_mutex_free(mutex);

	thread_end_func = NULL;

	zend_hash_clean(&thread_ids);
}
예제 #12
0
void php_shutdown_crypt_r()
{
#ifdef ZTS
	tsrm_mutex_free(php_crypt_extended_init_lock);
#endif
}
예제 #13
0
static int php_http_gnutls_mutex_destroy(void **m)
{
	tsrm_mutex_free(*((MUTEX_T *) m));
	return SUCCESS;
}