コード例 #1
0
ファイル: dynstats.c プロジェクト: boomft/rsyslog
static rsRetVal
dynstats_resetBucket(dynstats_bucket_t *b, uint8_t do_purge) {
	size_t htab_sz;
	DEFiRet;
	htab_sz = (size_t) (DYNSTATS_HASHTABLE_SIZE_OVERPROVISIONING * b->maxCardinality + 1);
	pthread_rwlock_wrlock(&b->lock);
	if (do_purge) {
		dynstats_destroyCounters(b);
	}
	ATOMIC_STORE_0_TO_INT(&b->metricCount, &b->mutMetricCount);
	STATSCOUNTER_INC(b->ctrPurgeTriggered, b->mutCtrPurgeTriggered);
    b->ctrs = NULL;
	if ((b->table = create_hashtable(htab_sz, hash_from_string, key_equals_string, no_op_free)) == NULL) {
		errmsg.LogError(errno, RS_RET_INTERNAL_ERROR, "error trying to initialize hash-table for dyn-stats bucket named: %s", b->name);
		ABORT_FINALIZE(RS_RET_INTERNAL_ERROR);
	}
			
	timeoutComp(&b->metricCleanupTimeout, b->unusedMetricLife);
finalize_it:
	pthread_rwlock_unlock(&b->lock);
	if (iRet != RS_RET_OK) {
		statsobj.Destruct(&b->stats);
	}
	RETiRet;
}
コード例 #2
0
ファイル: wti.c プロジェクト: Joungkyun/rsyslog
wtiSetState(wti_t *pThis, const int newVal)
{
	ISOBJ_TYPE_assert(pThis, wti);
	if(newVal == WRKTHRD_STOPPED) {
		ATOMIC_STORE_0_TO_INT(&pThis->bIsRunning, &pThis->mutIsRunning);
	} else {
		ATOMIC_OR_INT_TO_INT(&pThis->bIsRunning, &pThis->mutIsRunning, newVal);
	}
	return RS_RET_OK;
}
コード例 #3
0
ファイル: wti.c プロジェクト: JosephGregg/rsyslog
/* Set status (thread is running or not), actually an property of
 * use for wtp, but we need to have it per thread instance (thus it
 * is inside wti). -- rgerhards, 2009-07-17
 */
rsRetVal
wtiSetState(wti_t *pThis, sbool bNewVal)
{
	ISOBJ_TYPE_assert(pThis, wti);
	if(bNewVal) {
		ATOMIC_STORE_1_TO_INT(&pThis->bIsRunning, &pThis->mutIsRunning);
	} else {
		ATOMIC_STORE_0_TO_INT(&pThis->bIsRunning, &pThis->mutIsRunning);
	}
	return RS_RET_OK;
}