Which is the correct way to wait for a Thread.finalization and keep my application responsive

前端 未结 5 1335
陌清茗
陌清茗 2021-02-07 18:02

Actually i am using this code and works ok, but i \'am wondering if is the correct way.

  while WaitForSingleObject(MyThread.Handle, 0) = WAIT_TIMEOUT do
    App         


        
5条回答
  •  抹茶落季
    2021-02-07 18:46

    The VCL TThread class has its own WaitFor() method that pumps the main message queue internally when called within the main thread context:

    MyThread.WaitFor; 
    ShowMessage('i am done'); 
    

提交回复
热议问题