27 panic(
"sleeping in a blackhole?");
83MALLOC_DEFINE(M_POLL_REG,
"poll-reg",
"a queue a thread polls");
117 if (r->queue ==
queue)
164 if (r->queue ==
waitq)
void arch_sleep(void)
Puts the current thread to sleep.
#define MALLOC_DEFINE(type, _name, _desc)
void * kmalloc(size_t size, struct malloc_type *type, int flags)
Allocates memory for one of the kernel's structures.
void kfree(void *)
Frees an object that kmalloc() gave.
#define list_entry(node, type, member)
void sched_thread_wake(struct thread *thread)
Makes a thread that was sleeping ready to run.
int signal_interrupts(struct thread *thread)
Says whether a thread has a signal to take, which ends a sleep that a signal may end.
A link in a list, inside the structure that is listed.
One wait queue that one polling thread waits for.
struct poll_reg * thread_next
struct list_node run_link
it's on the ready list (sched.c) while it's ready to run, or on the wait queue it sleeps on (waitq); ...
struct poll_reg * poll_regs
in select() or poll(): what it waits for (poll_register()), and where it sleeps meanwhile
static void sleep_on(struct waitq *waitq, state_t state)
Puts the current thread to sleep on waitq in state (ISLEEP or USLEEP), and returns once it has been w...
static struct poll_reg ** poll_chain(struct waitq *queue)
Returns the hash chain that registrations of queue are on.
static struct poll_reg * poll_hash[POLL_HASH]
static void poll_wake(struct waitq *waitq)
Wakes up the threads polling waitq, and those polling any queue.
void thread_wakeup(struct thread *thread)
Wakes up one thread, if it is sleeping on a wait queue.
void waitq_wakeup_nopoll(struct waitq *waitq)
Wakes up every thread sleeping on a wait queue, but not the threads polling it.
void waitq_wakeup(struct waitq *waitq)
Wakes up every thread sleeping on a wait queue, and every thread polling it.
void poll_unregister(struct thread *thread)
Removes every registration of a thread, when it stops waiting (it was woken up, or it is going away).
void waitq_sleep_unint(struct waitq *waitq)
Puts the current thread to sleep on a wait queue until it is woken up, whatever signals come meanwhil...
int waitq_sleep(struct waitq *waitq)
Puts the current thread to sleep on a wait queue until it is woken up.
int poll_register(struct waitq *waitq)
Registers a wait queue that the current thread, in select() or poll(), waits for: a wakeup of that qu...