5static int next (
int pos);
92 || (waiter == &q->not_full &&
intq_full (q)));
107 || (waiter == &q->not_full && !
intq_full (q)));
#define ASSERT(CONDITION)
This is outside the header guard so that debug.h may be included multiple times with different settin...
#define UNUSED
GCC lets us add "attributes" to functions, function parameters, etc.
bool intr_context(void)
Returns true during processing of an external interrupt and false at all other times.
enum intr_level intr_get_level(void)
Returns the current interrupt status.
@ INTR_OFF
Interrupts disabled.
static void wait(struct intq *q, struct thread **waiter)
bool intq_empty(const struct intq *q)
Returns true if Q is empty, false otherwise.
uint8_t intq_getc(struct intq *q)
Removes a byte from Q and returns it.
void intq_putc(struct intq *q, uint8_t byte)
Adds BYTE to the end of Q.
void intq_init(struct intq *q)
Initializes interrupt queue Q.
static int next(int pos)
Returns the position after POS within an intq.
static void signal(struct intq *q, struct thread **waiter)
bool intq_full(const struct intq *q)
Returns true if Q is full, false otherwise.
#define INTQ_BUFSIZE
An "interrupt queue", a circular buffer shared between kernel threads and external interrupt handlers...
A circular queue of bytes.
struct lock lock
Only one thread may wait at once.
struct thread * not_empty
Thread waiting for not-empty condition.
int head
New data is written here.
int tail
Old data is read here.
uint8_t buf[INTQ_BUFSIZE]
Buffer.
struct thread * not_full
Thread waiting for not-full condition.
A kernel thread or user process.
void lock_release(struct lock *lock)
Releases LOCK, which must be owned by the current thread.
void lock_init(struct lock *lock)
Initializes LOCK.
void lock_acquire(struct lock *lock)
Acquires LOCK, sleeping until it becomes available if necessary.
struct thread * thread_current(void)
Returns the running thread.
void thread_unblock(struct thread *t)
Transitions a blocked thread T to the ready-to-run state.
void thread_block(void)
Puts the current thread to sleep.