mirror of
https://github.com/status-im/nim-chronos.git
synced 2025-03-02 11:50:38 +00:00
Fix RangeError defect being happened using android toolchain. (#538)
* Fix RangeError defect being happened using android toolchain. * Set proper type for `Tnfds`. * Update comment.
This commit is contained in:
parent
bb96f02ae8
commit
72f560f049
@ -220,7 +220,10 @@ proc selectInto2*[T](s: Selector[T], timeout: int,
|
||||
verifySelectParams(timeout, -1, int(high(cint)))
|
||||
|
||||
let
|
||||
maxEventsCount = min(len(s.pollfds), len(readyKeys))
|
||||
maxEventsCount = culong(min(len(s.pollfds), len(readyKeys)))
|
||||
# Without `culong` conversion, this code could fail with RangeError
|
||||
# defect on explicit Tnfds(integer) conversion (probably related to
|
||||
# combination of nim+clang (android toolchain)).
|
||||
eventsCount =
|
||||
if maxEventsCount > 0:
|
||||
let res = handleEintr(poll(addr(s.pollfds[0]), Tnfds(maxEventsCount),
|
||||
|
@ -965,7 +965,7 @@ elif defined(macos) or defined(macosx):
|
||||
events*: cshort
|
||||
revents*: cshort
|
||||
|
||||
Tnfds* {.importc: "nfds_t", header: "<poll.h>".} = cuint
|
||||
Tnfds* {.importc: "nfds_t", header: "<poll.h>".} = culong
|
||||
|
||||
const
|
||||
POLLIN* = 0x0001
|
||||
|
Loading…
x
Reference in New Issue
Block a user