-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathqueue.h
More file actions
35 lines (30 loc) · 877 Bytes
/
Copy pathqueue.h
File metadata and controls
35 lines (30 loc) · 877 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#ifndef QUEUE_H
#define QUEUE_H
#include <pthread.h>
#include "miniseed.h"
// 队列节点结构
typedef struct QueueNode {
char network[3];
char station[6];
char location[3];
char channel[4];
unsigned char data[512]; // miniSEED数据
struct QueueNode* next;
} QueueNode;
// 队列结构
typedef struct {
QueueNode* front;
QueueNode* rear;
pthread_mutex_t mutex;
pthread_cond_t not_empty;
int size;
} DataQueue;
// 函数声明
DataQueue* queue_create(void);
void queue_destroy(DataQueue* queue);
int queue_push(DataQueue* queue, const char* network, const char* station,
const char* location, const char* channel, const unsigned char* data);
int queue_pop(DataQueue* queue, char* network, char* station,
char* location, char* channel, unsigned char* data);
int queue_size(DataQueue* queue);
#endif