public delegate void FuncO <T1>(out T1 arg1); public static void LockedCall <T1>(string name, FuncO <T1> func, out T1 arg1) { while (true) { try { var mutex = new Mutex(false, name); mutex.WaitOne(); func(out arg1); mutex.ReleaseMutex(); } catch (AbandonedMutexException) { } } }
public delegate U FuncO <T1, U>(out T1 arg1); public static U LockedCall <T1, U>(string name, FuncO <T1, U> func, out T1 arg1) { while (true) { try { var mutex = new Mutex(false, name); mutex.WaitOne(); U result = func(out arg1); mutex.ReleaseMutex(); return(result); } catch (AbandonedMutexException) { } } }
public BaseOutputProcessor(FuncO <string, T, bool> handler) { this.handler = handler; }
/// <summary> /// The first input that the <paramref name="handler"/> returns true will be /// the result of this output processor, all other inputs will be ignored. /// </summary> /// <param name="handler"></param> public FirstResultOutputProcessor(FuncO <string, T, bool> handler = null) : base(handler) { }
public BaseOutputListProcessor(FuncO <string, T, bool> handler) : base(handler) { }