Esempio n. 1
0
PRIVATE void dispatcher_thread(void *unused) {

	/* 
	 * Gets all messages and dispatches them.
	 *
	 * NOTE: this thread runs only when no other ddekit is 
	 *       ready. So please take care that youre threads
	 *       leave some time for the others!
	 */
	message m;
	int r;
	int i;

	_ddekit_thread_set_myprio(0);

	for( ; ; ) {

		/* Trigger a timer interrupt at each loop iteration */
		_ddekit_timer_update();
		
		/* Wait for messages */
		if ((r = sef_receive(ANY, &m)) != 0) { 
				ddekit_panic("ddekit", "sef_receive failed", r);
		}

		
		_ddekit_timer_interrupt(); 
		
		_ddekit_thread_wakeup_sleeping();
		
		if (is_notify(m.m_type)) {
			switch (_ENDPOINT_P(m.m_source)) { 
				case HARDWARE:
					for	(i =0 ; i < 32 ; i++)
					{
						if(m.NOTIFY_ARG & (1 << i)) 
						{
							_ddekit_interrupt_trigger(i);
						}
					}
					break;
				case CLOCK:
					_ddekit_timer_pending = 0;
					break;
				default:
					ddekit_thread_schedule();
			}

		} else {
			
			/* 
			 * I don't know how to handle this msg,
			 * but maybe we have a msg queue which can
			 * handle this msg.
			 */

			ddekit_minix_queue_msg(&m);
		} 
	}
}
Esempio n. 2
0
PRIVATE void ddekit_dispatcher_thread_init()
{

	dispatch_th = ddekit_thread_create(dispatcher_thread, NULL, "dispatch");

	ddekit_thread_schedule();
}
Esempio n. 3
0
/* Our version of scheduler invocation.
 *
 * Scheduling is performed by Fiasco, so we don't care about it as long as
 * a thread is running. If a task becomes TASK_INTERRUPTIBLE or
 * TASK_UNINTERRUPTIBLE, we make sure that the task does not become
 * scheduled by locking the task's sleep lock.
 */
asmlinkage void schedule(void)
{
	dde26_thread_data *t = lxtask_to_ddethread(current);

	switch (current->state) {
		case TASK_RUNNING:
			ddekit_thread_schedule();
			break;
		case TASK_INTERRUPTIBLE:
		case TASK_UNINTERRUPTIBLE:
			ddekit_sem_down(SLEEP_LOCK(t));
			break;
		default:
			panic("current->state = %d --- unknown state\n", current->state);
	}
}