我有一个动作(StartJob),它启动一个长时间运行的工作线程。我正在尝试另一个操作(GetStatusFromWrokerThread)返回LongRunningJob进程的当前状态。这可能吗?
public ActionResult StartJob(int[] instList)
{
permissionCheck = new Thread(LongRunningJob);
permissionCheck.Start();
var jr = new JsonNetResult();
jr.Formatting = Newtonsoft.Json.Formatting.Indented;
jr.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
jr.Data = (inQueue <= 0?0:inQueue);
return jr;
}
public ActionResult GetStatusFromWrokerThread()
{
// how to get a status code or message from LongRunningJob
// the thread started in the action above
var jr = new JsonNetResult();
jr.Formatting = Newtonsoft.Json.Formatting.Indented;
jr.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
jr.Data = (inQueue <= 0 ? 0 : inQueue);
return jr;
}