mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 12:20:41 +00:00
socket server added
This commit is contained in:
31
skynet-src/socket_poll.h
Normal file
31
skynet-src/socket_poll.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef socket_poll_h
|
||||
#define socket_poll_h
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
typedef int poll_fd;
|
||||
|
||||
struct event {
|
||||
void * s;
|
||||
bool read;
|
||||
bool write;
|
||||
};
|
||||
|
||||
static bool sp_invalid(poll_fd fd);
|
||||
static poll_fd sp_create();
|
||||
static void sp_release(poll_fd fd);
|
||||
static int sp_add(poll_fd fd, int sock, void *ud);
|
||||
static void sp_del(poll_fd fd, int sock);
|
||||
static void sp_write(poll_fd, int sock, void *ud, bool enable);
|
||||
static int sp_wait(poll_fd, struct event *e, int max);
|
||||
static void sp_nonblocking(int sock);
|
||||
|
||||
#ifdef __linux__
|
||||
#include "socket_epoll.h"
|
||||
#endif
|
||||
|
||||
#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__OpenBSD__) || defined (__NetBSD__)
|
||||
#include "socket_kqueue.h"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user