Time limiting a method in C#

后端 未结 6 2021
小蘑菇
小蘑菇 2021-02-02 17:16

I have a Game framework where there is a list of Bots who implement IBotInterface. These bots are custom made by user with the only limitation that they must implement the inter

6条回答
  •  遥遥无期
    2021-02-02 18:01

    One option is certainly to spin up a new Thread yourself, rather than relying on BeginInvoke. You can implement the timeout via Thread.Join and (unceremoniously) kill the thread, if necessary, via Thread.Abort.

提交回复
热议问题