Allow async stdin

This commit is contained in:
Yuriy Glukhov 2018-07-24 23:24:14 +03:00
commit 34f398d010
5 changed files with 51 additions and 48 deletions

View file

@ -261,6 +261,9 @@ else:
param: int
data: T
const
InvalidIdent = -1
proc raiseIOSelectorsError[T](message: T) =
var msg = ""
when T is string:
@ -302,6 +305,12 @@ else:
if posix.sigprocmask(SIG_UNBLOCK, newmask, oldmask) == -1:
raiseIOSelectorsError(osLastError())
template clearKey[T](key: ptr SelectorKey[T]) =
var empty: T
key.ident = InvalidIdent
key.events = {}
key.data = empty
when defined(linux):
include ioselects/ioselectors_epoll
elif bsdPlatform: