mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-10-01 03:43:51 +08:00
openpilot v0.6 release
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
#ifndef COMMON_CQUEUE_H
|
||||
#define COMMON_CQUEUE_H
|
||||
|
||||
#include <sys/queue.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
// a blocking queue
|
||||
|
||||
typedef struct QueueEntry {
|
||||
TAILQ_ENTRY(QueueEntry) entries;
|
||||
void *data;
|
||||
} QueueEntry;
|
||||
|
||||
typedef struct Queue {
|
||||
TAILQ_HEAD(queue, QueueEntry) q;
|
||||
pthread_mutex_t lock;
|
||||
pthread_cond_t cv;
|
||||
} Queue;
|
||||
|
||||
void queue_init(Queue *q);
|
||||
void* queue_pop(Queue *q);
|
||||
void* queue_try_pop(Queue *q);
|
||||
void queue_push(Queue *q, void *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
} // extern "C"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user