initial commit

This commit is contained in:
2025-08-05 15:53:44 +08:00
commit 09dc02ae52
553 changed files with 137665 additions and 0 deletions

39
third_party/libhv/event/iowatcher.h vendored Executable file
View File

@@ -0,0 +1,39 @@
#ifndef IO_WATCHER_H_
#define IO_WATCHER_H_
#include "hloop.h"
#include "hplatform.h"
#if !defined(EVENT_SELECT) && \
!defined(EVENT_POLL) && \
!defined(EVENT_EPOLL) && \
!defined(EVENT_KQUEUE) && \
!defined(EVENT_IOCP) && \
!defined(EVENT_PORT) && \
!defined(EVENT_NOEVENT)
#ifdef OS_WIN
#if WITH_WEPOLL
#define EVENT_EPOLL // wepoll -> iocp
#else
#define EVENT_POLL // WSAPoll
#endif
#elif defined(OS_LINUX)
#define EVENT_EPOLL
#elif defined(OS_MAC)
#define EVENT_KQUEUE
#elif defined(OS_BSD)
#define EVENT_KQUEUE
#elif defined(OS_SOLARIS)
#define EVENT_PORT
#else
#define EVENT_SELECT
#endif
#endif
int iowatcher_init(hloop_t* loop);
int iowatcher_cleanup(hloop_t* loop);
int iowatcher_add_event(hloop_t* loop, int fd, int events);
int iowatcher_del_event(hloop_t* loop, int fd, int events);
int iowatcher_poll_events(hloop_t* loop, int timeout);
#endif