Is it guaranteed that a thread will complete in aspnet?

前端 未结 2 1582
滥情空心
滥情空心 2021-01-24 07:50

I have this simple code in aspnet :assuming no exceptions nor file locking nor process terminates :

    new Thread(()=>{
          Thread.sleep(15000);
             


        
2条回答
  •  萌比男神i
    2021-01-24 08:22

    Unless the thread is aborted or the above statements throw exceptions, yes, it will always be created (leaving file permissions and IO problems out of the picture).

    Reasons the thread might be aborted:

    • (Manual) application pool recycle;
    • Request abandoned;
    • Crash of application.

提交回复
热议问题