我没有找到这种情况的确切情况。我搜索了SO,每个例子似乎都想完成他们先做的事情。是否有一个事件样式thread.terminate命令,允许我关闭一个线程,即使它当前正在进行数据库调用?我的意思不是:
public void threadhere()
{
while (!variable)
{
do something;
}
end thread;
}
我的意思更像是:
public void threadhere
{
making a database call and the condition changes while querying database
so I will stop doing what I am doing and terminate the thread
}