-
Notifications
You must be signed in to change notification settings - Fork 30
Expand file tree
/
Copy pathqueue.h
More file actions
34 lines (26 loc) · 701 Bytes
/
queue.h
File metadata and controls
34 lines (26 loc) · 701 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
/*-
* xnumon - monitor macOS for malicious activity
* https://www.roe.ch/xnumon
*
* Copyright (c) 2017-2019, Daniel Roethlisberger <daniel@roe.ch>.
* All rights reserved.
*
* Licensed under the Open Software License version 3.0.
*/
#ifndef QUEUE_H
#define QUEUE_H
#include "attrib.h"
#include "tommylist.h"
#include <pthread.h>
typedef struct {
tommy_list list;
pthread_mutex_t mutex;
pthread_cond_t notempty;
size_t size;
} queue_t;
void queue_init(queue_t *) NONNULL(1);
void queue_destroy(queue_t *) NONNULL(1);
void queue_enqueue(queue_t *, tommy_node *, void *) NONNULL(1,2,3);
void * queue_dequeue(queue_t *) NONNULL(1);
#define queue_size(Q) (Q)->size
#endif