stuff2
This commit is contained in:
@@ -21,12 +21,12 @@ zn_status_t channel_create(struct channel** ep0, struct channel** ep1) {
|
||||
|
||||
a->peer = b;
|
||||
a->lock = (struct spinlock){0};
|
||||
TAILQ_INIT(&a->messages);
|
||||
tailq_init(&a->messages);
|
||||
wait_queue_init(&a->waiters);
|
||||
|
||||
b->peer = a;
|
||||
b->lock = (struct spinlock){0};
|
||||
TAILQ_INIT(&b->messages);
|
||||
tailq_init(&b->messages);
|
||||
wait_queue_init(&b->waiters);
|
||||
|
||||
*ep0 = a;
|
||||
@@ -64,7 +64,7 @@ zn_status_t channel_write(
|
||||
|
||||
// Enqueue on the peer's message queue and wake a waiter.
|
||||
spin_lock(&peer->lock);
|
||||
TAILQ_INSERT_TAIL(&peer->messages, msg, next);
|
||||
tailq_insert_tail(&peer->messages, msg, next);
|
||||
spin_unlock(&peer->lock);
|
||||
|
||||
struct sched_percpu* sched = &percpu_get()->sched;
|
||||
@@ -75,10 +75,10 @@ zn_status_t channel_write(
|
||||
|
||||
zn_status_t channel_read(struct channel* ch, struct channel_msg** msg_out) {
|
||||
spin_lock(&ch->lock);
|
||||
struct channel_msg* msg = TAILQ_FIRST(&ch->messages);
|
||||
struct channel_msg* msg = tailq_first(&ch->messages);
|
||||
|
||||
if (msg != nullptr) {
|
||||
TAILQ_REMOVE(&ch->messages, msg, next);
|
||||
tailq_remove(&ch->messages, msg, next);
|
||||
spin_unlock(&ch->lock);
|
||||
*msg_out = msg;
|
||||
return ZN_OK;
|
||||
@@ -97,7 +97,7 @@ zn_status_t channel_read(struct channel* ch, struct channel_msg** msg_out) {
|
||||
zn_status_t channel_poll(struct channel* ch) {
|
||||
spin_lock(&ch->lock);
|
||||
|
||||
if (!TAILQ_EMPTY(&ch->messages)) {
|
||||
if (!tailq_empty(&ch->messages)) {
|
||||
spin_unlock(&ch->lock);
|
||||
return ZN_OK;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user