mirror of
https://github.com/bol-van/zapret.git
synced 2025-08-17 00:03:27 +03:00
Truncated history
This commit is contained in:
31
tpws/epoll-shim/src/eventfd_ctx.h
Normal file
31
tpws/epoll-shim/src/eventfd_ctx.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef EVENTFD_CTX_H_
|
||||
#define EVENTFD_CTX_H_
|
||||
|
||||
#include "fix.h"
|
||||
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#define EVENTFD_CTX_FLAG_SEMAPHORE (1 << 0)
|
||||
|
||||
typedef struct {
|
||||
int kq_; // non owning
|
||||
int flags_;
|
||||
pthread_mutex_t mutex_;
|
||||
|
||||
bool is_signalled_;
|
||||
int self_pipe_[2]; // only used if EVFILT_USER is not available
|
||||
uint_least64_t counter_;
|
||||
} EventFDCtx;
|
||||
|
||||
errno_t eventfd_ctx_init(EventFDCtx *eventfd, int kq, unsigned int counter,
|
||||
int flags);
|
||||
errno_t eventfd_ctx_terminate(EventFDCtx *eventfd);
|
||||
|
||||
errno_t eventfd_ctx_write(EventFDCtx *eventfd, uint64_t value);
|
||||
errno_t eventfd_ctx_read(EventFDCtx *eventfd, uint64_t *value);
|
||||
|
||||
#endif
|
Reference in New Issue
Block a user