Thread timeout in c#

前端 未结 7 614
春和景丽
春和景丽 2021-01-11 18:41

I\'m new to threading in C#. Is there anyway of setting a timeout for a thread without blocking the calling thread (in C# 3.5)?

If not, is it logical to execute a fu

7条回答
  •  不知归路
    2021-01-11 19:38

    I checked and the simplest and most comprehensive way of doing it was the solution I mentioned in the description of the question. A middle level thread can easily wait for the second thread without any interruption over the main thread; and it can kill the second thread if it does not respond within the required time. That's exactly what I needed. I used it and it worked without a problem.

提交回复
热议问题