本文整理汇总了C#中IJob.Run方法的典型用法代码示例。如果您正苦于以下问题:C# IJob.Run方法的具体用法?C# IJob.Run怎么用?C# IJob.Run使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IJob
的用法示例。
在下文中一共展示了IJob.Run方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessJobThread
private static void ProcessJobThread()
{
while(true) {
current_running_job = null;
if(suspend_count > 0) {
Thread.Sleep(10);
continue;
}
lock(this_mutex) {
if(disposed) {
Log.Debug ("execution thread destroyed, dispose requested");
return;
}
try {
current_running_job = heap.Pop();
} catch(InvalidOperationException) {
Debug("execution thread destroyed, no more jobs scheduled");
job_thread = null;
return;
}
}
try {
Debug("Job started ({0})", current_running_job);
OnJobStarted(current_running_job);
current_running_job.Run();
Debug("Job ended ({0})", current_running_job);
OnJobFinished(current_running_job);
} catch(Exception e) {
Debug("Job threw an unhandled exception: {0}", e);
}
}
}
示例2: ProcessJobThread
private static void ProcessJobThread()
{
while(true) {
current_running_job = null;
if(suspend_count > 0) {
Thread.Sleep(10);
continue;
}
lock(this_mutex) {
if(disposed) {
job_thread = null;
return;
}
try {
current_running_job = heap.Pop();
} catch(InvalidOperationException) {
job_thread = null;
return;
}
}
try {
OnJobStarted(current_running_job);
current_running_job.Run();
OnJobFinished(current_running_job);
} catch(Exception e) {
Log.Error (e);
}
}
}