316 |
return thread; |
return thread; |
317 |
} |
} |
318 |
|
|
|
/* Dispatch THREAD that have been active or suspended. |
|
|
This puts the thread on the run queue. */ |
|
|
|
|
|
static void |
|
|
thread_dispatch (struct thread *thread) |
|
|
{ |
|
|
/* ??? check stuff. */ |
|
|
#if 0 |
|
|
if (thread->swap_fn != 0) |
|
|
thread->sched_state |= THREAD_STATE_SWAPPED; |
|
|
#endif |
|
|
|
|
|
add_thread_to_run_queue (thread); |
|
|
} |
|
|
|
|
319 |
/* Called when the current thread is given a new stack. */ |
/* Called when the current thread is given a new stack. */ |
320 |
|
|
321 |
static void |
static void |
524 |
if (thread->wait_event == event) |
if (thread->wait_event == event) |
525 |
{ |
{ |
526 |
trace_printf ("found waiting thread"); |
trace_printf ("found waiting thread"); |
|
|
|
527 |
|
|
528 |
queue_remove (&wait_queues [hash_index], thread, |
queue_remove (&wait_queues [hash_index], thread, |
529 |
struct thread *, waitq); |
struct thread *, waitq); |
566 |
} |
} |
567 |
|
|
568 |
|
|
569 |
|
/* Interrupt THREAD. Bring it back from waiting state. */ |
570 |
|
|
571 |
|
void |
572 |
|
thread_interrupt (struct thread *thread) |
573 |
|
{ |
574 |
|
clear_wait (thread, 0); |
575 |
|
} |
576 |
|
|
577 |
/* Resume THREAD. If suspend counter drops to zero, we resume |
/* Resume THREAD. If suspend counter drops to zero, we resume |
578 |
execution of the thread and puts it on the run queue. */ |
execution of the thread and puts it on the run queue. */ |
579 |
|
|