put std/threads under the umbrella of nimPreviewSlimSystem (#20711)
* put `std/threads` under the umbrella of `nimPreviewSlimSystem` * add changelog * fixes tests * fixes tests again * fixes tests
This commit is contained in:
parent
fb2ec8d192
commit
e1ddd2d524
13 changed files with 33 additions and 19 deletions
|
|
@ -33,6 +33,15 @@ template afterThreadRuns() =
|
|||
for i in countdown(nimThreadDestructionHandlers.len-1, 0):
|
||||
nimThreadDestructionHandlers[i]()
|
||||
|
||||
proc onThreadDestruction*(handler: proc () {.closure, gcsafe, raises: [].}) =
|
||||
## Registers a *thread local* handler that is called at the thread's
|
||||
## destruction.
|
||||
##
|
||||
## A thread is destructed when the `.thread` proc returns
|
||||
## normally or when it raises an exception. Note that unhandled exceptions
|
||||
## in a thread nevertheless cause the whole process to die.
|
||||
nimThreadDestructionHandlers.add handler
|
||||
|
||||
when defined(boehmgc):
|
||||
type GCStackBaseProc = proc(sb: pointer, t: pointer) {.noconv.}
|
||||
proc boehmGC_call_with_stack_base(sbp: GCStackBaseProc, p: pointer)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue