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>
This commit is contained in:
flywind 2022-07-06 19:06:41 +08:00 • committed by GitHub
commit 430a179307
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 17 additions and 9 deletions

View file

@ -26,6 +26,8 @@ becomes an alias for `addr`.
- The `gc:v2` option is removed. - The `gc:v2` option is removed.
- The `threads:on` option becomes the default.
## Standard library additions and changes ## Standard library additions and changes
[//]: # "Changes:" [//]: # "Changes:"

View file

@ -17,6 +17,8 @@ cc = gcc
hint[LineTooLong]=off hint[LineTooLong]=off
#hint[XDeclaredButNotUsed]=off #hint[XDeclaredButNotUsed]=off
threads:on
# Examples of how to setup a cross-compiler: # Examples of how to setup a cross-compiler:
# Nim can target architectures and OSes different than the local host # Nim can target architectures and OSes different than the local host
# Syntax: <arch>.<os>.gcc.exe = "<compiler executable>" # Syntax: <arch>.<os>.gcc.exe = "<compiler executable>"

View file

@ -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) var test2 = makeTest("tests/dll/server.nim", options & " --threads:on" & rpath, cat)
test2.spec.action = actionCompile test2.spec.action = actionCompile
testSpec c, test2 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 test3.spec.action = actionCompile
testSpec c, test3 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 test4.spec.action = actionCompile
testSpec c, test4 testSpec c, test4
@ -77,13 +77,13 @@ proc runBasicDLLTest(c, r: var TResults, cat: Category, options: string) =
defer: putEnv(libpathenv, libpath) defer: putEnv(libpathenv, libpath)
testSpec r, makeTest("tests/dll/client.nim", options & " --threads:on" & rpath, cat) 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/nimhcr_unit.nim", options & " --threads:off" & rpath, cat)
testSpec r, makeTest("tests/dll/visibility.nim", options & rpath, cat) testSpec r, makeTest("tests/dll/visibility.nim", options & " --threads:off" & rpath, cat)
if "boehm" notin options: if "boehm" notin options:
# force build required - see the comments in the .nim file for more details # force build required - see the comments in the .nim file for more details
var hcri = makeTest("tests/dll/nimhcr_integration.nim", 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 nimcache = nimcacheDir(hcri.name, hcri.options, getTestSpecTarget())
let cmd = prepareTestCmd(hcri.spec.getCmd, hcri.name, let cmd = prepareTestCmd(hcri.spec.getCmd, hcri.name,
hcri.options, nimcache, getTestSpecTarget()) hcri.options, nimcache, getTestSpecTarget())

View file

@ -1,5 +1,5 @@
discard """ 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" action: "compile"
""" """

View file

@ -47,7 +47,7 @@ proc `=destroy`(x: var MyObject) =
proc `=`(x: var MyObject, y: MyObject) {.error.} proc `=`(x: var MyObject, y: MyObject) {.error.}
proc newMyObject(i: int): MyObject = proc newMyObject(i: int): MyObject =
result.p = create(int) result.p = createShared(int)
result.p[] = i result.p[] = i
proc test: seq[MyObject] = proc test: seq[MyObject] =

2
tests/ic/config.nims Normal file
View file

@ -0,0 +1,2 @@
when defined(windows):
--threads:off

View file

@ -2,3 +2,4 @@
--cpu:avr --cpu:avr
--os:standalone --os:standalone
--compileOnly --compileOnly
--threads:off

View file

@ -1,5 +1,6 @@
discard """ discard """
action: compile action: compile
matrix: "--threads:off"
""" """
import asyncdispatch, times import asyncdispatch, times

View file

@ -1,6 +1,6 @@
discard """ discard """
targets: "c cpp" targets: "c cpp"
matrix: "--gc:orc" matrix: "--gc:orc --threads:off"
""" """
import std/[tasks, strformat] import std/[tasks, strformat]

View file

@ -1,5 +1,5 @@
discard """ discard """
matrix: "--gc:none -d:useMalloc" matrix: "--gc:none -d:useMalloc --threads:off"
""" """
# bug #15617 # bug #15617
let x = 4 let x = 4