public static WaitHandle[] GetHandles(SyncObject[] objs) { WaitHandle[] waitHandles = new WaitHandle[objs.Length]; for (int i = 0; i < objs.Length; i++) { waitHandles[i] = objs[i].Handle; } return waitHandles; }
/// <summary> /// ���Ӷ��� /// </summary> /// <param name="obj"></param> public static void AddObject(SyncObject obj) { SyncObject tempObj = GetObject(obj.Name); if (tempObj != null) { if (tempObj == obj) { throw new FireSpiderException("�������һ��ͬ�������μ��뵽�߳̿�������"); } throw new FireSpiderException("�Ѿ�����һ������Ϊ\"" + obj.Name + "\"��ͬ������"); } objectList.Add(obj.Name, obj); if (ObjectAdded != null) { ObjectAdded(obj); } }
public static int WaitAny(SyncObject[] objs, int dwMilliseconds, bool exitContext) { WaitHandle[] waitHandles = GetHandles(objs); return WaitHandle.WaitAny(waitHandles, dwMilliseconds, exitContext); }