コード例 #1
0
ファイル: seq_if.c プロジェクト: ukaea/epics
/*
 * Return whether event flag is set.
 */
epicsShareFunc boolean seq_efTest(SS_ID ss, EF_ID ev_flag)
/* event flag */
{
	PROG	*sp = ss->prog;
	boolean	isSet;

	assert(ev_flag > 0 && ev_flag <= ss->prog->numEvFlags);
	epicsMutexMustLock(sp->lock);

	isSet = bitTest(sp->evFlags, ev_flag);

	DEBUG("efTest: ev_flag=%d, isSet=%d\n", ev_flag, isSet);

	if (optTest(sp, OPT_SAFE))
		ss_read_buffer_selective(sp, ss, ev_flag);

	epicsMutexUnlock(sp->lock);

	return isSet;
}
コード例 #2
0
ファイル: seq_if.c プロジェクト: A2-Collaboration/epics
/*
 * Atomically test event flag against outstanding events, then clear it
 * and return whether it was set.
 */
epicsShareFunc boolean epicsShareAPI seq_efTestAndClear(SS_ID ss, EV_ID ev_flag)
{
	SPROG	*sp = ss->sprog;
	boolean	isSet;

	assert(ev_flag > 0 && ev_flag <= ss->sprog->numEvFlags);
	epicsMutexMustLock(sp->programLock);

	isSet = bitTest(sp->evFlags, ev_flag);
	bitClear(sp->evFlags, ev_flag);

	DEBUG("efTestAndClear: ev_flag=%d, isSet=%d, ss=%d\n", ev_flag, isSet, (int)ssNum(ss));

	if (sp->options & OPT_SAFE)
		ss_read_buffer_selective(sp, ss, ev_flag);

	epicsMutexUnlock(sp->programLock);

	return isSet;
}