Simple task: make a while that update's status.label value,

but it is not possible to implement via threads, because function cannot be 
gcsafe when it calls global status to update its value and it is not possible 
to transmit status.value via channel because of target while app.mainLoop() 
cannot be extended, to inject channel catcher and it is not possible to start 
app.mainLoop() as separated thread, because it is not gcsafe too.

So idk how to implement it.
    
    
    import
      os,
      resource/resource,
      wNim
    
    var app = App()
    var frame = Frame(title="wNim while test", style=wDefaultFrameStyle or 
wModalFrame)
    
    frame.size = (200, 100)
    
    var panel = Panel(frame)
    panel.margin = 10
    
    var status = StaticText(panel, label="...")
    
    status.label = "null"
    
    frame.center()
    frame.show()
    
    proc mywhile() =
      var i = 0
      while(true):
        status.label = $i
        echo i
        i = i + 1
        os.sleep(1000)
    
    status_ch.open()
    
    var th2: Thread[void]
    createThread(th2, mywhile)
    app.mainLoop()
    
    th2.joinThread()
    
    
    Run

Reply via email to