summary refs log tree commit diff stats
path: root/lib/system
diff options
context:
space:
mode:
Diffstat (limited to 'lib/system')
-rw-r--r--lib/system/channels.nim2
-rw-r--r--lib/system/inclrtl.nim8
-rw-r--r--lib/system/threads.nim4
3 files changed, 8 insertions, 6 deletions
diff --git a/lib/system/channels.nim b/lib/system/channels.nim
index 2e66680ef..e5535dbdc 100644
--- a/lib/system/channels.nim
+++ b/lib/system/channels.nim
@@ -29,7 +29,7 @@ type
     region: TMemRegion

   PRawChannel = ptr TRawChannel

   TLoadStoreMode = enum mStore, mLoad

-  TChannel*[TMsg] = TRawChannel ## a channel for thread communication

+  TChannel* {.gcsafe.}[TMsg] = TRawChannel ## a channel for thread communication

 

 const ChannelDeadMask = -2

 

diff --git a/lib/system/inclrtl.nim b/lib/system/inclrtl.nim
index 9831130e2..475a09686 100644
--- a/lib/system/inclrtl.nim
+++ b/lib/system/inclrtl.nim
@@ -16,6 +16,8 @@
 #    -> defined(useNimRtl) or appType == "lib" and not defined(createNimRtl)
 # 3) Exported into nimrtl.
 #    -> appType == "lib" and defined(createNimRtl)
+when not defined(nimNewShared):
+  {.pragma: gcsafe.}
 
 when defined(createNimRtl):
   when defined(useNimRtl): 
@@ -24,7 +26,7 @@ when defined(createNimRtl):
     {.error: "nimrtl must be built as a library!".}
 
 when defined(createNimRtl): 
-  {.pragma: rtl, exportc: "nimrtl_$1", dynlib.}
+  {.pragma: rtl, exportc: "nimrtl_$1", dynlib, gcsafe.}
   {.pragma: inl.}
   {.pragma: compilerRtl, compilerproc, exportc: "nimrtl_$1", dynlib.}
 elif defined(useNimRtl):
@@ -34,11 +36,11 @@ elif defined(useNimRtl):
     const nimrtl* = "nimrtl.dylib"
   else: 
     const nimrtl* = "libnimrtl.so"
-  {.pragma: rtl, importc: "nimrtl_$1", dynlib: nimrtl.}
+  {.pragma: rtl, importc: "nimrtl_$1", dynlib: nimrtl, gcsafe.}
   {.pragma: inl.}
   {.pragma: compilerRtl, compilerproc, importc: "nimrtl_$1", dynlib: nimrtl.}
 else:
-  {.pragma: rtl.}
+  {.pragma: rtl, gcsafe.}
   {.pragma: inl, inline.}
   {.pragma: compilerRtl, compilerproc.}
 
diff --git a/lib/system/threads.nim b/lib/system/threads.nim
index ff9ab6cc0..0d52e4d09 100644
--- a/lib/system/threads.nim
+++ b/lib/system/threads.nim
@@ -256,9 +256,9 @@ type
                           ## that **must not** be part of a message! Use
                           ## a ``TThreadId`` for that.
     when TArg is void:
-      dataFn: proc () {.nimcall.}
+      dataFn: proc () {.nimcall, gcsafe.}
     else:
-      dataFn: proc (m: TArg) {.nimcall.}
+      dataFn: proc (m: TArg) {.nimcall, gcsafe.}
       data: TArg
   TThreadId*[TArg] = ptr TThread[TArg] ## the current implementation uses
                                        ## a pointer as a thread ID.