1 #include "libthreads.h"
5 struct thread_list_node {
7 struct thread_list_node *next;
11 #define NUM_LIST_NODES 32
13 struct thread_list_node *head, *tail;
14 struct thread_list_node nodes[NUM_LIST_NODES];
16 static void enqueue_thread(struct thread *t)
19 struct thread_list_node *node;
21 for (node = nodes, i = 0; node->live && i < NUM_LIST_NODES; i++, node++);
22 if (i >= NUM_LIST_NODES)
23 printf("ran out of nodes\n");
35 struct thread *dequeue_thread(void)
51 void schedule_add_thread(struct thread *t)
53 DEBUG("thread %d\n", t->index);
57 struct thread *schedule_choose_next(void)
59 return dequeue_thread();