summary refs log tree commit diff stats
path: root/lib/pure/selectors.nim
diff options
context:
space:
mode:
Diffstat (limited to 'lib/pure/selectors.nim')
-rw-r--r--lib/pure/selectors.nim8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/pure/selectors.nim b/lib/pure/selectors.nim
index b9c834127..e2ab98ba8 100644
--- a/lib/pure/selectors.nim
+++ b/lib/pure/selectors.nim
@@ -314,6 +314,14 @@ else:
     key.events = {}
     key.data = empty
 
+  proc verifySelectParams(timeout: int) =
+    # Timeout of -1 means: wait forever
+    # Anything higher is the time to wait in miliseconds.
+    if timeout < -1:
+      raise newException(
+        ValueError, "Cannot select with a negative value, got " & $timeout
+      )
+
   when defined(linux):
     include ioselects/ioselectors_epoll
   elif bsdPlatform: