summary refs log blame commit diff stats
path: root/tests/threads/t7172.nim
blob: 87e89417b924aea78fede1057f76b9f50cd9f676 (plain) (tree)
1
2
3
4
5
6
7
           
                


                
    
                  





                            
                       







                                     
                    
                            









                                      
discard """
  disabled: i386
  output: '''
In doStuff()
In initProcess()
TEST
initProcess() done
Crashes before getting here!
'''
  joinable: false
"""

import std/os
import std/typedthreads

proc whatever() {.thread, nimcall.} =
  echo("TEST")

proc initProcess(): void =
  echo("In initProcess()")
  var thread: Thread[void]
  createThread(thread, whatever)
  joinThread(thread)
  echo("initProcess() done")

proc doStuff(): void =
  echo("In doStuff()")
  # ...
  initProcess()
  sleep(500)
  # ...
  echo("Crashes before getting here!")

doStuff()