Wait for a while without blocking main thread

前端 未结 8 1016
慢半拍i
慢半拍i 2020-12-01 20:50

I wish my method to wait about 500 ms and then check if some flag has changed. How to complete this without blocking the rest of my application?

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-01 21:11

    System.Threading.Thread.Sleep(500);
    

    Update

    This won't block the rest of your application, just the thread that is running your method.

提交回复
热议问题