[std/tasks] more gcsafe stuffs [backport] (#18926)

This commit is contained in:
flywind
2021-09-30 13:46:30 +08:00
committed by GitHub
parent f35e9a5752
commit 6bb32da4ae

View File

@@ -61,12 +61,12 @@ type
Task* = object ## `Task` contains the callback and its arguments.
callback: proc (args: pointer) {.nimcall, gcsafe.}
args: pointer
destroy: proc (args: pointer) {.nimcall.}
destroy: proc (args: pointer) {.nimcall, gcsafe.}
proc `=copy`*(x: var Task, y: Task) {.error.}
proc `=destroy`*(t: var Task) {.inline.} =
proc `=destroy`*(t: var Task) {.inline, gcsafe.} =
## Frees the resources allocated for a `Task`.
if t.args != nil:
if t.destroy != nil:
@@ -219,7 +219,7 @@ macro toTask*(e: typed{nkCall | nkInfix | nkPrefix | nkPostfix | nkCommand | nkC
let `objTemp` = cast[ptr `scratchObjType`](args)
`functionStmtList`
proc `destroyName`(args: pointer) {.nimcall.} =
proc `destroyName`(args: pointer) {.gcsafe, nimcall.} =
let `objTemp2` = cast[ptr `scratchObjType`](args)
`tempNode`