summary refs log tree commit diff stats
path: root/lib
diff options
context:
space:
mode:
authorRay Imber <rayimber@gmail.com>2019-09-26 06:45:50 -0700
committerAndreas Rumpf <rumpf_a@web.de>2019-09-26 15:45:50 +0200
commit9dd297f613768bb170e05dcaf361015d9448c582 (patch)
tree9cc8c2e36d6b5dd39b30ed60ea04a327edc0d366 /lib
parent944fcc0e62bb22b9f5da79909dfbda4371de1fc6 (diff)
downloadNim-9dd297f613768bb170e05dcaf361015d9448c582.tar.gz
Locks modules should give a compile error when threads are not enabled. (#12231)
* Locks modules should give a compile error when threads are not enabled.

* fix the compile flags to make the tests pass, or ignore files where necessary.

* Fixed when statement to account for doc builds.
Diffstat (limited to 'lib')
-rw-r--r--lib/core/locks.nim4
-rw-r--r--lib/core/rlocks.nim4
2 files changed, 8 insertions, 0 deletions
diff --git a/lib/core/locks.nim b/lib/core/locks.nim
index 0143957ce..392c8aed4 100644
--- a/lib/core/locks.nim
+++ b/lib/core/locks.nim
@@ -9,6 +9,10 @@
 
 ## This module contains Nim's support for locks and condition vars.
 
+
+when not compileOption("threads") and not defined(nimdoc):
+  {.error: "Locks requires --threads:on option.".}
+
 const insideRLocksModule = false
 include "system/syslocks"
 
diff --git a/lib/core/rlocks.nim b/lib/core/rlocks.nim
index 4710d6cf1..34d7687f9 100644
--- a/lib/core/rlocks.nim
+++ b/lib/core/rlocks.nim
@@ -9,6 +9,10 @@
 
 ## This module contains Nim's support for reentrant locks.
 
+
+when not compileOption("threads") and not defined(nimdoc):
+  {.error: "Rlocks requires --threads:on option.".}
+
 const insideRLocksModule = true
 include "system/syslocks"