Beispiel #1
0
/* Free a mutex */
TSRM_API void tsrm_mutex_free(MUTEX_T mutexp)
{
	if (mutexp) {
#ifdef TSRM_WIN32
		DeleteCriticalSection(mutexp);
		free(mutexp);
#elif defined(GNUPTH)
		free(mutexp);
#elif defined(PTHREADS)
		pthread_mutex_destroy(mutexp);
		free(mutexp);
#elif defined(NSAPI)
		crit_terminate(mutexp);
#elif defined(PI3WEB)
		PISync_delete(mutexp);
#elif defined(TSRM_ST)
		st_mutex_destroy(mutexp);
#elif defined(BETHREADS)
		delete_sem(mutexp->sem);
		free(mutexp);  
#endif
	}
#ifdef THR_DEBUG
	printf("Mutex freed thread: %d\n",mythreadid());
#endif
}
Beispiel #2
0
void
ACL_Attr2IndexListDestroy(void)
{
	PListDestroy(ACLAttr2IndexPList);
	if(acl_parse_crit)
		crit_terminate(acl_parse_crit);
	acl_free_buffer();
}
NSAPI_PUBLIC void 
cache_destroy(void *cache_ptr)
{
	cache_t *cache = (cache_t *)cache_ptr;
	cache_t *search, *last;
	cache_entry_t *ptr;
SOLARIS_PROBE(cache_destroy_start, "cache");

#ifdef IRIX
        NS_ASSERT(!cache->fast_mode);
#endif

	NS_ASSERT(cache_crit);
	NS_ASSERT(cache_ptr);
#ifdef CACHE_DEBUG
	NS_ASSERT(cache->magic == CACHE_MAGIC);
#endif

	crit_enter(cache_crit);
	crit_enter(cache->lock);

	ptr = cache->lru_head;
	while(ptr) {
		/* Caller MUST bump the access_count before calling delete
		 * We can do this since we hold the cache lock.  
		 */
		cache_use_increment(cache, ptr);
		cache_delete(cache, ptr, 0);
		ptr = cache->lru_head;
	}

	PERM_FREE(cache->table);

	cache->max_size = 0;
	cache->hash_size = 0;

	for ( last = NULL, search = cache_list; search; last = search,
		search = search->next)
		if (search == cache)
			break;

	if (search) {
		if (last) 
			last->next = search->next;
		else
			cache_list = search->next;
	}
	else {
		ereport(LOG_WARN, XP_GetAdminStr(DBT_cacheDestroyCacheTablesAppearCor_));
	}
	crit_exit(cache_crit);
	crit_exit(cache->lock);

	crit_terminate(cache->lock);

	PERM_FREE(cache);
SOLARIS_PROBE(cache_destroy_end, "cache");
}
Beispiel #4
0
NSAPI_PUBLIC void
fsmutex_terminate(FSMUTEX id)
{
    fsmutex_s *fsm = (fsmutex_s *) id;

    _fsmutex_delete(fsm);
#ifdef THREAD_ANY
    if(fsm->flags & FSMUTEX_NEEDCRIT)
        crit_terminate(fsm->crit);
#endif
    PERM_FREE(fsm);
}
Beispiel #5
0
NSAPI_PUBLIC void agent_cleanup(void *args) {
    am_properties_destroy(agent_props.agent_bootstrap_props);
    am_web_cleanup();
    crit_terminate(initLock);
}