* fixes #18858 [backport] * ensure async tests work with --experimental:strictEffects [backport] * ensure async tests work with --experimental:strictEffects [backport]
This commit is contained in:
parent
ca51bb8fd9
commit
3241df2a13
4 changed files with 11 additions and 3 deletions
|
|
@ -93,7 +93,7 @@ proc setCallSoonProc*(p: (proc(cbproc: proc ()) {.gcsafe.})) =
|
||||||
## Change current implementation of `callSoon`. This is normally called when dispatcher from `asyncdispatcher` is initialized.
|
## Change current implementation of `callSoon`. This is normally called when dispatcher from `asyncdispatcher` is initialized.
|
||||||
callSoonProc = p
|
callSoonProc = p
|
||||||
|
|
||||||
proc callSoon*(cbproc: proc ()) =
|
proc callSoon*(cbproc: proc () {.gcsafe.}) =
|
||||||
## Call `cbproc` "soon".
|
## Call `cbproc` "soon".
|
||||||
##
|
##
|
||||||
## If async dispatcher is running, `cbproc` will be executed during next dispatcher tick.
|
## If async dispatcher is running, `cbproc` will be executed during next dispatcher tick.
|
||||||
|
|
|
||||||
|
|
@ -330,12 +330,16 @@ proc countProcessors*(): int {.rtl, extern: "nosp$1".} =
|
||||||
## It is implemented just calling `cpuinfo.countProcessors`.
|
## It is implemented just calling `cpuinfo.countProcessors`.
|
||||||
result = cpuinfo.countProcessors()
|
result = cpuinfo.countProcessors()
|
||||||
|
|
||||||
|
when not defined(nimHasEffectsOf):
|
||||||
|
{.pragma: effectsOf.}
|
||||||
|
|
||||||
proc execProcesses*(cmds: openArray[string],
|
proc execProcesses*(cmds: openArray[string],
|
||||||
options = {poStdErrToStdOut, poParentStreams}, n = countProcessors(),
|
options = {poStdErrToStdOut, poParentStreams}, n = countProcessors(),
|
||||||
beforeRunEvent: proc(idx: int) = nil,
|
beforeRunEvent: proc(idx: int) = nil,
|
||||||
afterRunEvent: proc(idx: int, p: Process) = nil):
|
afterRunEvent: proc(idx: int, p: Process) = nil):
|
||||||
int {.rtl, extern: "nosp$1",
|
int {.rtl, extern: "nosp$1",
|
||||||
tags: [ExecIOEffect, TimeEffect, ReadEnvEffect, RootEffect].} =
|
tags: [ExecIOEffect, TimeEffect, ReadEnvEffect, RootEffect],
|
||||||
|
effectsOf: [beforeRunEvent, afterRunEvent].} =
|
||||||
## Executes the commands `cmds` in parallel.
|
## Executes the commands `cmds` in parallel.
|
||||||
## Creates `n` processes that execute in parallel.
|
## Creates `n` processes that execute in parallel.
|
||||||
##
|
##
|
||||||
|
|
|
||||||
|
|
@ -705,8 +705,11 @@ proc capitalize*(s: string): string {.noSideEffect,
|
||||||
fastRuneAt(s, i, rune, doInc = true)
|
fastRuneAt(s, i, rune, doInc = true)
|
||||||
result = $toUpper(rune) & substr(s, i)
|
result = $toUpper(rune) & substr(s, i)
|
||||||
|
|
||||||
|
when not defined(nimHasEffectsOf):
|
||||||
|
{.pragma: effectsOf.}
|
||||||
|
|
||||||
proc translate*(s: string, replacements: proc(key: string): string): string {.
|
proc translate*(s: string, replacements: proc(key: string): string): string {.
|
||||||
rtl, extern: "nuc$1".} =
|
rtl, extern: "nuc$1", effectsOf: replacements.} =
|
||||||
## Translates words in a string using the ``replacements`` proc to substitute
|
## Translates words in a string using the ``replacements`` proc to substitute
|
||||||
## words inside ``s`` with their replacements.
|
## words inside ``s`` with their replacements.
|
||||||
##
|
##
|
||||||
|
|
|
||||||
1
tests/async/nim.cfg
Normal file
1
tests/async/nim.cfg
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
--experimental:strictEffects
|
||||||
Loading…
Add table
Add a link
Reference in a new issue