Home

Awesome

wepoll

Windows epoll wrapper based on wepoll

Installation

nimble install wepoll

API

Docs from https://github.com/piscisaureus/wepoll

General remarks

epoll_create/epoll_create1

proc epoll_create*(size: cint): EpollHandle
proc epoll_create1*(flags: cint): EpollHandle

epoll_close

proc epoll_close*(ephnd: EpollHandle): cint

epoll_ctl

proc epoll_ctl*(ephnd: EpollHandle, op: cint, 
                sock: EpollSocket, event: ptr EpollEvent): cint {.wepoll.}

epoll_wait

proc epoll_wait*(ephnd: EpollHandle, events: ptr EpollEvent, 
                 maxevents: cint, timeout: cint): cint {.wepoll.}

object EpollEvent

type
  EpollHandle* = pointer

  EpollSocket* = culonglong
type
  EpollData* {.bycopy, union.} = object
    p*: pointer
    fd*: cint
    u32*: uint32
    u64*: uint64
    sock*: EpollSocket         ##  Windows specific
    hnd*: EpollHandle          ##  Windows specific
type
  EpollEvent* {.bycopy.} = object
    events*: uint32          ##  Epoll events and flags
    data*: EpollData         ##  User data variable
EventDescription
EPOLLINincoming data available, or incoming connection ready to be accepted
EPOLLOUTready to send data, or outgoing connection successfully established
EPOLLRDHUPremote peer initiated graceful socket shutdown
EPOLLPRIout-of-band data available for reading
EPOLLERRsocket error<sup>1</sup>
EPOLLHUPsocket hang-up<sup>1</sup>
EPOLLRDNORMsame as EPOLLIN
EPOLLRDBANDsame as EPOLLPRI
EPOLLWRNORMsame as EPOLLOUT
EPOLLWRBANDsame as EPOLLOUT
EPOLLMSGnever reported
FlagDescription
EPOLLONESHOTreport event(s) only once
EPOLLETnot supported by wepoll
EPOLLEXCLUSIVEnot supported by wepoll
EPOLLWAKEUPnot supported by wepoll

<sup>1</sup>: the EPOLLERR and EPOLLHUP events may always be reported by epoll_wait(), regardless of the event mask that was passed to epoll_ctl().