c# - Killing a .NET thread -
I have created a thread by running a certain method. But sometimes I would like to kill the thread, even if it is still working. how can I do this? I tried threads Ebert () but it shows a message box that says "thread aborted". What should I do?
thread. Assistant
is dangerous. Instead, you should cooperate with the thread so that it can be stopped peacefully. The thread needs to be designed so that it can be asked to kill itself, for example when you want to stop the thread, the boolean containing the
flag that you set to false then the thread As if
works (go) {/ * if the thread can block in a sleep
or wait
, then you By calling them can break it from those tasks. Thread should be ready for a threaded interpolation exposure
: to try (keep running) {/ do the job. Hold (threaded interrupted exception exception) {/ * Clear * /}
Comments
Post a Comment