[async] rename msgq.rgn to msgq.msg_rgn

This commit is contained in:
Milo Turner 2020-02-25 12:18:49 -05:00
parent 26e66d9f61
commit 3936c26feb
3 changed files with 6 additions and 5 deletions

View File

@ -6,7 +6,7 @@ static void msgq_cleanup(struct msgq* mq);
struct msgq* msgq_new(struct rgn* init_rgn) struct msgq* msgq_new(struct rgn* init_rgn)
{ {
struct msgq* mq = ralloc_typed(init_rgn, struct msgq, 1); struct msgq* mq = ralloc_typed(init_rgn, struct msgq, 1);
mq->rgn = rgn_new(init_rgn, MEDIUM); mq->msg_rgn = rgn_new(init_rgn, SMALL);
mq->head = mq->tail = NULL; mq->head = mq->tail = NULL;
pthread_mutex_init(&mq->mx, NULL); pthread_mutex_init(&mq->mx, NULL);
pthread_cond_init(&mq->cv, NULL); pthread_cond_init(&mq->cv, NULL);
@ -26,7 +26,8 @@ static void msgq_cleanup(struct msgq* mq)
void* msgq_begin_send(struct msgq* mq, int type, size_t payload_size) void* msgq_begin_send(struct msgq* mq, int type, size_t payload_size)
{ {
pthread_mutex_lock(&mq->mx); pthread_mutex_lock(&mq->mx);
struct msgq_msg_list* msg = ralloc(mq->rgn, sizeof(struct msgq_msg_list) + payload_size); struct msgq_msg_list* msg =
ralloc(mq->msg_rgn, sizeof(struct msgq_msg_list) + payload_size);
msg->next = NULL; msg->next = NULL;
msg->type = type; msg->type = type;
if (mq->head == NULL) { if (mq->head == NULL) {
@ -76,6 +77,6 @@ void* msgq_recv1(struct msgq* mq, int* out_type)
void msgq_end_recv(struct msgq* mq) void msgq_end_recv(struct msgq* mq)
{ {
mq->head = mq->tail = NULL; mq->head = mq->tail = NULL;
rgn_clear(mq->rgn); rgn_clear(mq->msg_rgn);
pthread_mutex_unlock(&mq->mx); pthread_mutex_unlock(&mq->mx);
} }

View File

@ -6,7 +6,7 @@
struct msgq_msg_list; struct msgq_msg_list;
struct msgq { struct msgq {
struct rgn* rgn; struct rgn* msg_rgn;
struct msgq_msg_list* head; struct msgq_msg_list* head;
struct msgq_msg_list* tail; struct msgq_msg_list* tail;
pthread_mutex_t mx; pthread_mutex_t mx;

View File

@ -37,7 +37,7 @@ struct ax_window* ax__window_builder_finish(
struct ax_msg_make_window* m = struct ax_msg_make_window* m =
msgq_begin_send_typed(req_window_mq, ax_msg_make_window); msgq_begin_send_typed(req_window_mq, ax_msg_make_window);
m->dst_win = win; m->dst_win = win;
m->title = rstrdup(req_window_mq->rgn, winb->title); m->title = rstrdup(req_window_mq->msg_rgn, winb->title);
m->width = winb->w; m->width = winb->w;
m->height = winb->h; m->height = winb->h;
m->flags = winb->flags; m->flags = winb->flags;