Skip to content

Crash when using thread and --gc:arc  #13881

Closed
@cdxf

Description

The following code works with default gc, but will crash after the first iteration when using --gc:arc

Example

import os

proc threadFunc(i:int ) {.thread.} =
  echo("Performing...")
  os.sleep(100)
when isMainModule:
  while true:
    echo("Starting...")
    var thr:  array[0..3, Thread[int]]
    for i in 0..high(thr):
      createThread(thr[i], threadFunc, i)
    joinThreads(thr)
    echo("Done...")

Current Output

Crash after first iteration

Expected Output

Perform next iteration
$ nim -v
Nim Compiler Version 1.2.0 [Windows: amd64]
(Tried on Linux too)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions