* code:

    
    
    import std/[strformat]
      import std/[os]
      import std/typedthreads
      import std/[monotimes, times]
      
      var threads: seq[Thread[void]] = @[]
      
      let st = getMonoTime()
      
      proc doSleep() =
        sleep 3000
      
      for i in 0 ..< 10:
        var t: Thread[void]
        createThread(t, doSleep)
        threads.add t
      
      for t in threads.items:
        t.joinThread
      
      let ed = getMonoTime()
      
      echo fmt"elapsed: {(ed-st).inMilliseconds}ms"
    
    
    
    Run

  * error:


    
    
    Error: '=dup' is not available for type <Thread[system.void]>, which is infe
    rred from unavailable '=copy'; requires a copy because it's not the last 
read of 't'; routine: thread
    
    
    
    Run

Reply via email to