Skip to content

Commit d60e021

Browse files
bptatoringabout
andauthored
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 <[email protected]>
1 parent 88da5e8 commit d60e021

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lib/pure/selectors.nim

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@
2525
## Solaris (files, sockets, handles and user events).
2626
## Android (files, sockets, handles and user events).
2727
##
28+
## By default, the implementation is chosen based on the target
29+
## platform; you can pass `-d:nimIoselector=value` to override it.
30+
## Accepted values are "epoll", "kqueue", "poll", and "select".
31+
##
2832
## TODO: `/dev/poll`, `event ports` and filesystem events.
2933

3034
import std/nativesockets
@@ -342,7 +346,9 @@ else:
342346
res = int(fdLim.rlim_cur) - 1
343347
res
344348

345-
when defined(nimIoselector):
349+
const nimIoselector {.strdefine.} = ""
350+
351+
when nimIoselector != "":
346352
when nimIoselector == "epoll":
347353
include ioselects/ioselectors_epoll
348354
elif nimIoselector == "kqueue":

0 commit comments

Comments
 (0)