3 #include "libthreads.h"
8 struct thread_list_node {
10 struct thread_list_node *next;
14 #define NUM_LIST_NODES 32
16 struct thread_list_node *head, *tail;
17 struct thread_list_node nodes[NUM_LIST_NODES];
18 struct thread *current;
20 static void enqueue_thread(struct thread *t)
23 struct thread_list_node *node;
25 for (node = nodes, i = 0; node->live && i < NUM_LIST_NODES; i++, node++);
26 if (i >= NUM_LIST_NODES) {
27 printf("ran out of nodes\n");
41 static struct thread *dequeue_thread(void)
54 /* Set new current thread */
60 void DefaultScheduler::add_thread(struct thread *t)
62 DEBUG("thread %d\n", t->id);
66 struct thread *DefaultScheduler::next_thread(void)
68 return dequeue_thread();
71 struct thread *DefaultScheduler::get_current_thread(void)