[Krafton Jungle] PintOS 2.0.0
크래프톤 정글 PintOS
 
Loading...
Searching...
No Matches
intq.h File Reference
#include "threads/interrupt.h"
#include "threads/synch.h"
Include dependency graph for intq.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  intq
 

Macros

#define INTQ_BUFSIZE   64
 

Functions

void intq_init (struct intq *)
 
bool intq_empty (const struct intq *)
 
bool intq_full (const struct intq *)
 
uint8_t intq_getc (struct intq *)
 
void intq_putc (struct intq *, uint8_t)
 

Macro Definition Documentation

◆ INTQ_BUFSIZE

#define INTQ_BUFSIZE   64

Function Documentation

◆ intq_empty()

bool intq_empty ( const struct intq q)
19 {
21 return q->head == q->tail;
22}
#define ASSERT(CONDITION)
Definition: debug.h:30
@ INTR_OFF
Definition: interrupt.h:9
enum intr_level intr_get_level(void)
Definition: interrupt.c:115
int head
Definition: intq.h:32
int tail
Definition: intq.h:33
Here is the call graph for this function:
Here is the caller graph for this function:

◆ intq_full()

bool intq_full ( const struct intq q)
26 {
28 return next (q->head) == q->tail;
29}
static int next(int pos)
Definition: intq.c:74
Here is the call graph for this function:
Here is the caller graph for this function:

◆ intq_getc()

uint8_t intq_getc ( struct intq q)
36 {
37 uint8_t byte;
38
40 while (intq_empty (q)) {
41 ASSERT (!intr_context ());
42 lock_acquire (&q->lock);
43 wait (q, &q->not_empty);
44 lock_release (&q->lock);
45 }
46
47 byte = q->buf[q->tail];
48 q->tail = next (q->tail);
49 signal (q, &q->not_full);
50 return byte;
51}
bool intr_context(void)
Definition: interrupt.c:258
static void wait(struct intq *q, struct thread **waiter)
bool intq_empty(const struct intq *q)
Definition: intq.c:19
static void signal(struct intq *q, struct thread **waiter)
unsigned char uint8_t
Definition: stdint.h:20
struct lock lock
Definition: intq.h:26
struct thread * not_empty
Definition: intq.h:28
uint8_t buf[INTQ_BUFSIZE]
Definition: intq.h:31
struct thread * not_full
Definition: intq.h:27
void lock_release(struct lock *)
Definition: synch.c:243
void lock_acquire(struct lock *)
Definition: synch.c:202
Here is the call graph for this function:
Here is the caller graph for this function:

◆ intq_init()

void intq_init ( struct intq q)
11 {
12 lock_init (&q->lock);
13 q->not_full = q->not_empty = NULL;
14 q->head = q->tail = 0;
15}
#define NULL
Definition: stddef.h:4
void lock_init(struct lock *)
Definition: synch.c:186
Here is the call graph for this function:
Here is the caller graph for this function:

◆ intq_putc()

void intq_putc ( struct intq q,
uint8_t  byte 
)
58 {
60 while (intq_full (q)) {
61 ASSERT (!intr_context ());
62 lock_acquire (&q->lock);
63 wait (q, &q->not_full);
64 lock_release (&q->lock);
65 }
66
67 q->buf[q->head] = byte;
68 q->head = next (q->head);
69 signal (q, &q->not_empty);
70}
bool intq_full(const struct intq *q)
Definition: intq.c:26
Here is the call graph for this function:
Here is the caller graph for this function: