PKUOS - Pintos
Pintos source browser for PKU Operating System course
|
Go to the source code of this file.
Functions | |
static int | next (int pos) |
Returns the position after POS within an intq. More... | |
static void | wait (struct intq *q, struct thread **waiter) |
static void | signal (struct intq *q, struct thread **waiter) |
void | intq_init (struct intq *q) |
Initializes interrupt queue Q. More... | |
bool | intq_empty (const struct intq *q) |
Returns true if Q is empty, false otherwise. More... | |
bool | intq_full (const struct intq *q) |
Returns true if Q is full, false otherwise. More... | |
uint8_t | intq_getc (struct intq *q) |
Removes a byte from Q and returns it. More... | |
void | intq_putc (struct intq *q, uint8_t byte) |
Adds BYTE to the end of Q. More... | |
static void | wait (struct intq *q UNUSED, struct thread **waiter) |
WAITER must be the address of Q's not_empty or not_full member. More... | |
static void | signal (struct intq *q UNUSED, struct thread **waiter) |
WAITER must be the address of Q's not_empty or not_full member, and the associated condition must be true. More... | |
Returns true if Q is empty, false otherwise.
Definition at line 20 of file intq.c.
References ASSERT, intq::head, intr_get_level(), INTR_OFF, and intq::tail.
Referenced by intq_getc(), serial_flush(), serial_interrupt(), signal(), wait(), and write_ier().
Returns true if Q is full, false otherwise.
Definition at line 28 of file intq.c.
References ASSERT, intq::head, intr_get_level(), INTR_OFF, next(), and intq::tail.
Referenced by input_full(), input_putc(), intq_putc(), serial_putc(), signal(), and wait().
Removes a byte from Q and returns it.
If Q is empty, sleeps until a byte is added. When called from an interrupt handler, Q must not be empty.
Definition at line 38 of file intq.c.
References ASSERT, intq::buf, intq_empty(), intr_context(), intr_get_level(), INTR_OFF, intq::lock, lock_acquire(), lock_release(), next(), intq::not_empty, intq::not_full, signal(), intq::tail, and wait().
Referenced by input_getc(), serial_flush(), serial_interrupt(), and serial_putc().
void intq_init | ( | struct intq * | q | ) |
Initializes interrupt queue Q.
Definition at line 11 of file intq.c.
References intq::head, intq::lock, lock_init(), intq::not_empty, intq::not_full, NULL, and intq::tail.
Referenced by init_poll(), and input_init().
Adds BYTE to the end of Q.
If Q is full, sleeps until a byte is removed. When called from an interrupt handler, Q must not be full.
Definition at line 61 of file intq.c.
References ASSERT, intq::buf, intq::head, intq_full(), intr_context(), intr_get_level(), INTR_OFF, intq::lock, lock_acquire(), lock_release(), next(), intq::not_empty, intq::not_full, signal(), and wait().
Referenced by input_putc(), and serial_putc().
|
static |
Returns the position after POS within an intq.
Definition at line 79 of file intq.c.
References INTQ_BUFSIZE.
Referenced by hash_apply(), intq_full(), intq_getc(), intq_putc(), list_unique(), rehash(), and schedule().
WAITER must be the address of Q's not_empty or not_full member, and the associated condition must be true.
If a thread is waiting for the condition, wakes it up and resets the waiting thread.
Definition at line 103 of file intq.c.
References ASSERT, intq_empty(), intq_full(), intr_get_level(), INTR_OFF, NULL, and thread_unblock().
WAITER must be the address of Q's not_empty or not_full member.
Waits until the given condition is true.
Definition at line 87 of file intq.c.
References ASSERT, intq_empty(), intq_full(), intr_context(), intr_get_level(), INTR_OFF, thread_block(), and thread_current().
Referenced by intq_getc(), intq_putc(), main(), sort_chunks(), test_main(), and wait_children().