For some reason, it works as intended if I pass a ptr Lock to the function 
instead of initializing it inside the function:
    
    
    proc test(lock: ptr Lock) =
      parallelFor i in 0 ..< 10:
        captures:{lock}
        lock[].acquire()
        echo i
        lock[].release()
    
    when isMainModule:
      init(Weave)
      var lock: Lock
      lock.initLock()
      test(lock.addr)
      exit(Weave)
    
    
    Run

To be honest, this behaviour confuses me even more. I'm glad that I got it to 
work, though. 

Reply via email to