Esempio n. 1
0
/**
 * Configure the task's timer to fire an event at every periodic
 * interval that corresponds to the task's period.
 */
void Task::configureTimer()
{
	// Initialize the timer thread to invoke a function when it expires
	SIGEV_THREAD_INIT(&event, &taskTimerExpired, this, 0);
	
	// Configure the timer parameters (period signals only)
	timerSpec.it_value.tv_sec = 0;
	timerSpec.it_value.tv_nsec = 1;
	timerSpec.it_interval.tv_sec = 0;
	timerSpec.it_interval.tv_nsec = periodTime * NS_PER_MS;
}
Esempio n. 2
0
static const struct sigevent *
md_intr(void *d, int id) {
	struct mdriver_entry *md = d;
	int					r;

	if(md->intr != _NTO_INTR_SPARE) {
		InterruptDisable();
		r = md->handler(MDRIVER_PROCESS, md->data);
		InterruptEnable();
		if(r != 0) {
			md->intr = _NTO_INTR_SPARE;
			SIGEV_THREAD_INIT(&sigev, md_detach, md, &attr);
			return &sigev;
		}	
	}	
	return NULL;
}