Skip to content

Commit

Permalink
Disable threads for os:any (nim-lang#21425)
Browse files Browse the repository at this point in the history
  • Loading branch information
auxym authored and bung87 committed Jul 29, 2023
1 parent 7ccb28e commit d82bf65
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions config/nim.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ nimblepath="$home/.nimble/pkgs/"
gcc.options.always %= "${gcc.options.always} -fsanitize=null -fsanitize-undefined-trap-on-error"
@end

# Turn off threads support when compiling for bare-metal targets (--os:any)
@if any:
threads:off
@end

@if unix and mingw:
# Cross compile for Windows from Linux/OSX using MinGW
i386.windows.gcc.exe = "i686-w64-mingw32-gcc"
Expand Down
2 changes: 2 additions & 0 deletions lib/std/typedthreads.nim
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ when defined(nimPreviewSlimSystem):
when defined(genode):
import genode/env

when hostOS == "any":
{.error: "Threads not implemented for os:any. Please compile with --threads:off.".}

when hasAllocStack or defined(zephyr) or defined(freertos) or defined(nuttx) or
defined(cpu16) or defined(cpu8):
Expand Down

0 comments on commit d82bf65

Please sign in to comment.