summaryrefslogtreecommitdiff
path: root/include/mbgl/util/uv-channel.h
blob: ea5c279f6527721d74b41c2e92bb1120fe1e4d2b (plain)
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
#ifndef MBGL_UTIL_UV_CHANNEL
#define MBGL_UTIL_UV_CHANNEL

#ifdef __cplusplus
extern "C" {
#endif

#include <uv.h>

// Taken from http://navaneeth.github.io/blog/2013/08/02/channels-in-libuv/

typedef struct uv_chan_s uv_chan_t;

struct uv_chan_s {
    uv_mutex_t mutex;
    uv_cond_t cond;
    void *q[2];
};

int uv_chan_init(uv_chan_t *chan);
void uv_chan_send(uv_chan_t *chan, void *data);
void *uv_chan_receive(uv_chan_t *chan);
void uv_chan_destroy(uv_chan_t *chan);

#ifdef __cplusplus
}
#endif

#endif