summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorflywind <43030857+xflywind@users.noreply.github.com>2022-07-06 19:06:41 +0800
committerGitHub <noreply@github.com>2022-07-06 13:06:41 +0200
commit430a1793075866179b34790a461936023fca1c0a (patch)
tree59d4a3371a40e073a60532797bb5a433ffe7fdb2
parent01b40dc1d7c7c5331361341bdf305084c799c05b (diff)
downloadNim-430a1793075866179b34790a461936023fca1c0a.tar.gz
default threads on (#19368)
* default threads on

* make rst gcsafe

* ignore threads option for nimscript

* threads off

* use createShared for threads

* test without threads

* avr threds off

* avr threads off

* async threads off

* threads off

* fix ci

* restore option

* make CI pleased

* fix ic tests

* Update config.nims

* add changelog

* Update changelog.md

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>

Co-authored-by: konsumlamm <44230978+konsumlamm@users.noreply.github.com>
-rw-r--r--changelog.md2
-rw-r--r--config/nim.cfg2
-rw-r--r--testament/categories.nim10
-rw-r--r--tests/avr/thello.nim2
-rw-r--r--tests/destructor/trecursive.nim2
-rw-r--r--tests/ic/config.nims2
-rw-r--r--tests/manyloc/standalone2/tavr.nim.cfg1
-rw-r--r--tests/niminaction/Chapter7/Tweeter/src/tweeter.nim1
-rw-r--r--tests/stdlib/ttasks.nim2
-rw-r--r--tests/system/tgcnone.nim2
10 files changed, 17 insertions, 9 deletions
diff --git a/changelog.md b/changelog.md
index 98655eaa3..c35a403e6 100644
--- a/changelog.md
+++ b/changelog.md
@@ -26,6 +26,8 @@ becomes an alias for `addr`.
 
 - The `gc:v2` option is removed.
 
+- The `threads:on` option becomes the default.
+
 ## Standard library additions and changes
 
 [//]: # "Changes:"
diff --git a/config/nim.cfg b/config/nim.cfg
index 7fe279f56..37d12a02d 100644
--- a/config/nim.cfg
+++ b/config/nim.cfg
@@ -17,6 +17,8 @@ cc = gcc
 hint[LineTooLong]=off
 #hint[XDeclaredButNotUsed]=off
 
+threads:on
+
 # Examples of how to setup a cross-compiler:
 # Nim can target architectures and OSes different than the local host
 # Syntax: <arch>.<os>.gcc.exe = "<compiler executable>"
diff --git a/testament/categories.nim b/testament/categories.nim
index a092fec84..43ea9f0ee 100644
--- a/testament/categories.nim
+++ b/testament/categories.nim
@@ -59,10 +59,10 @@ proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) =
   var test2 = makeTest("tests/dll/server.nim", options & " --threads:on" & rpath, cat)
   test2.spec.action = actionCompile
   testSpec c, test2
-  var test3 = makeTest("lib/nimhcr.nim", options & " --outdir:tests/dll" & rpath, cat)
+  var test3 = makeTest("lib/nimhcr.nim", options & " --threads:off --outdir:tests/dll" & rpath, cat)
   test3.spec.action = actionCompile
   testSpec c, test3
-  var test4 = makeTest("tests/dll/visibility.nim", options & " --app:lib" & rpath, cat)
+  var test4 = makeTest("tests/dll/visibility.nim", options & " --threads:off --app:lib" & rpath, cat)
   test4.spec.action = actionCompile
   testSpec c, test4
 
@@ -77,13 +77,13 @@ proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) =
     defer: putEnv(libpathenv, libpath)
 
   testSpec r, makeTest("tests/dll/client.nim", options & " --threads:on" & rpath, cat)
-  testSpec r, makeTest("tests/dll/nimhcr_unit.nim", options & rpath, cat)
-  testSpec r, makeTest("tests/dll/visibility.nim", options & rpath, cat)
+  testSpec r, makeTest("tests/dll/nimhcr_unit.nim", options & " --threads:off" & rpath, cat)
+  testSpec r, makeTest("tests/dll/visibility.nim", options & " --threads:off" & rpath, cat)
 
   if "boehm" notin options:
     # force build required - see the comments in the .nim file for more details
     var hcri = makeTest("tests/dll/nimhcr_integration.nim",
-                                   options & " --forceBuild --hotCodeReloading:on" & rpath, cat)
+                                   options & " --threads:off --forceBuild --hotCodeReloading:on" & rpath, cat)
     let nimcache = nimcacheDir(hcri.name, hcri.options, getTestSpecTarget())
     let cmd = prepareTestCmd(hcri.spec.getCmd, hcri.name,
                                 hcri.options, nimcache, getTestSpecTarget())
diff --git a/tests/avr/thello.nim b/tests/avr/thello.nim
index a0191815c..7ebaeae5f 100644
--- a/tests/avr/thello.nim
+++ b/tests/avr/thello.nim
@@ -1,5 +1,5 @@
 discard """
-  cmd: "nim c --compileOnly --os:standalone --exceptions:quirky -d:noSignalHandler -d:danger $file"
+  cmd: "nim c --compileOnly --os:standalone --exceptions:quirky -d:noSignalHandler -d:danger --threads:off $file"
   action: "compile"
 """
 
diff --git a/tests/destructor/trecursive.nim b/tests/destructor/trecursive.nim
index 17a40e5a9..e7afa6ba9 100644
--- a/tests/destructor/trecursive.nim
+++ b/tests/destructor/trecursive.nim
@@ -47,7 +47,7 @@ proc `=destroy`(x: var MyObject) =
 proc `=`(x: var MyObject, y: MyObject) {.error.}
 
 proc newMyObject(i: int): MyObject = 
-  result.p = create(int)
+  result.p = createShared(int)
   result.p[] = i
 
 proc test: seq[MyObject] = 
diff --git a/tests/ic/config.nims b/tests/ic/config.nims
new file mode 100644
index 000000000..76b29a6aa
--- /dev/null
+++ b/tests/ic/config.nims
@@ -0,0 +1,2 @@
+when defined(windows):

+  --threads:off

diff --git a/tests/manyloc/standalone2/tavr.nim.cfg b/tests/manyloc/standalone2/tavr.nim.cfg
index e5291969d..2a31618d0 100644
--- a/tests/manyloc/standalone2/tavr.nim.cfg
+++ b/tests/manyloc/standalone2/tavr.nim.cfg
@@ -2,3 +2,4 @@
 --cpu:avr
 --os:standalone
 --compileOnly
+--threads:off
diff --git a/tests/niminaction/Chapter7/Tweeter/src/tweeter.nim b/tests/niminaction/Chapter7/Tweeter/src/tweeter.nim
index fe39278fb..2fac949b9 100644
--- a/tests/niminaction/Chapter7/Tweeter/src/tweeter.nim
+++ b/tests/niminaction/Chapter7/Tweeter/src/tweeter.nim
@@ -1,5 +1,6 @@
 discard """
 action: compile
+matrix: "--threads:off"
 """
 
 import asyncdispatch, times
diff --git a/tests/stdlib/ttasks.nim b/tests/stdlib/ttasks.nim
index 75fed9f9b..e90823aba 100644
--- a/tests/stdlib/ttasks.nim
+++ b/tests/stdlib/ttasks.nim
@@ -1,6 +1,6 @@
 discard """
   targets: "c cpp"
-  matrix: "--gc:orc"
+  matrix: "--gc:orc --threads:off"
 """
 
 import std/[tasks, strformat]
diff --git a/tests/system/tgcnone.nim b/tests/system/tgcnone.nim
index 700176d5f..47c6c6014 100644
--- a/tests/system/tgcnone.nim
+++ b/tests/system/tgcnone.nim
@@ -1,5 +1,5 @@
 discard """
-  matrix: "--gc:none -d:useMalloc"
+  matrix: "--gc:none -d:useMalloc --threads:off"
 """
 # bug #15617
 let x = 4