Event = enum EvRead, EvWrite, EvError
SelectorKey = object fd*: SocketHandle events*: set[Event] data*: SelectorData ## User object.
fd
listens for. ReadyInfo = tuple[key: SelectorKey, events: set[Event]]
Selector = ref object
proc hash(x: SocketHandle): Hash {.borrow.}
proc `$`(x: SocketHandle): string {.borrow.}
proc register(s: Selector; fd: SocketHandle; events: set[Event]; data: SelectorData): SelectorKey {. discardable, raises: [], tags: [].}
fd
to selector s
with a set of Event events
. proc update(s: Selector; fd: SocketHandle; events: set[Event]): SelectorKey {. discardable, raises: [], tags: [].}
fd
wants notifications for. proc unregister(s: Selector; fd: SocketHandle): SelectorKey {.discardable, raises: [], tags: [].}
fd
from selector s
. proc close(s: Selector) {.raises: [], tags: [].}
proc select(s: Selector; timeout: int): seq[ReadyInfo] {.raises: [], tags: [].}
events
field of the returned key
contains the original events for which the fd
was bound. This is contrary to the events
field of the ReadyInfo
tuple which determines which events are ready on the fd
. proc newSelector(): Selector {.raises: [], tags: [].}
proc contains(s: Selector; fd: SocketHandle): bool {.raises: [], tags: [].}
proc `[]`(s: Selector; fd: SocketHandle): SelectorKey {.raises: [], tags: [].}
fd
. proc contains(s: Selector; key: SelectorKey): bool {.raises: [], tags: [].}
proc len(s: Selector): int {.raises: [], tags: [].}
© 2006–2017 Andreas Rumpf
Licensed under the MIT License.
https://nim-lang.org/docs/selectors.html