public bool AwaitTermination(long n, Sharpen.TimeUnit unit) { WaitHandle[] handles; lock (tasks) { if (tasks.Count == 0) { return(true); } handles = tasks.ToArray(); } return(WaitHandle.WaitAll(handles, (int)unit.Convert(n, TimeUnit.MILLISECONDS))); }
public bool Await(long timeout, Sharpen.TimeUnit unit) { return(done.WaitOne((int)unit.Convert(timeout, TimeUnit.MILLISECONDS))); }