/* * Feynman -- Wayland compositor for GNU Emacs * * Copyright (c) 2022 Sameer Rahmani * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, version 2. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ #ifndef FEYNMAN_QUEUE_H #define FEYNMAN_QUEUE_H #include #include typedef enum event_enum { echo = 0, exit = 1, } event_type_t; typedef struct arguments { unsigned count; void **args; } arguments_t; typedef struct event { unsigned id; event_type_t event_type; arguments_t *args; } event_t; typedef struct queue { unsigned *head; unsigned *tail; unsigned size; event_t *events; } queue_t; queue_t *init_queue (unsigned size); void deinit_queue (queue_t *q); int enqueue_event (queue_t *q, event_t *event); event_t *pop_event (queue_t *q); bool is_queue_empty (queue_t *q); #endif