日期:2014-05-17 浏览次数:20910 次
using System;
using System.Threading;
using fastCSharp;
using fastCSharp.threading;
namespace showjim.console
{
/// <summary>
/// UI多任务阻塞处理
/// </summary>
public class uiWait
{
/// <summary>
/// 任务信息
/// </summary>
private class taskInfo
{
/// <summary>
/// 执行委托
/// </summary>
public action Action;
/// <summary>
/// 等待完成锁
/// </summary>
public object WaitLock;
/// <summary>
/// 任务是否已完成
/// </summary>
public bool isFinally;
/// <summary>
/// 等待任务完成
/// </summary>
public void Wait()
{
Monitor.Enter(WaitLock);
try
{
if (!isFinally) Monitor.Wait(WaitLock);
}
finally { Monitor.Exit(WaitLock); }
}
/// <summary>
/// 执行任务
/// </summary>