mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-28 17:04:41 +00:00
Fix nimIoselector define in std/selectors (#25104)
Also added some documentation to the header. See: https://forum.nim-lang.org/t/13311 > I did try using the flag, but couldn't get it to work. If I do -d:nimIoSelector, the defined check passes, but the other code fails to compile because there is no const named nimIoSelector. It seemed like a bug to me, do you have a working number compiler invocation? Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
This commit is contained in:
@@ -25,6 +25,10 @@
|
||||
## Solaris (files, sockets, handles and user events).
|
||||
## Android (files, sockets, handles and user events).
|
||||
##
|
||||
## By default, the implementation is chosen based on the target
|
||||
## platform; you can pass `-d:nimIoselector=value` to override it.
|
||||
## Accepted values are "epoll", "kqueue", "poll", and "select".
|
||||
##
|
||||
## TODO: `/dev/poll`, `event ports` and filesystem events.
|
||||
|
||||
import std/nativesockets
|
||||
@@ -342,7 +346,9 @@ else:
|
||||
res = int(fdLim.rlim_cur) - 1
|
||||
res
|
||||
|
||||
when defined(nimIoselector):
|
||||
const nimIoselector {.strdefine.} = ""
|
||||
|
||||
when nimIoselector != "":
|
||||
when nimIoselector == "epoll":
|
||||
include ioselects/ioselectors_epoll
|
||||
elif nimIoselector == "kqueue":
|
||||
|
||||
Reference in New Issue
Block a user