Skip to content

Thread var cannot be returned from a proc. Causing SIGSEV #23652

Open
@Alogani

Description

@Alogani

Description

Hello,

Apparently, it is not possible to create a thread var and return it from a proc. It causes a SIGSEV

import os

proc threadMain() {.thread.} =
    sleep(100000)

proc main(): Thread[void] =
    var th: Thread[void]
    createThread(th, threadMain)
    return th

var th = main()
joinThread(th)

Nim Version

nim v2.0.4 on Fedora

Current Output

No stack traceback available
SIGSEGV: Illegal storage access. (Attempt to read from nil?)

Expected Output

No response

Possible Solution

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationRelated to documentation content (not generation).Threads

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions