控制器是:
bool isThreadComplete = false;
public ActionResult generateDoc()
{
Thread thread = new Thread(threadSleep);
thread.Start();
return Json(true);
}
public void threadSleep()
{
Thread.Sleep(30000);
isThreadComplete = true;
}
public ActionResult callThreadSleep() {
return Json(isThreadComplete);
}
当我使用ajax调用callThreadSleep
时,即使在30秒之后它也没有设置变量isThreadComplete
的值。任何建议?