private static Exception JoinWithTimeout(Thread t, int timeout) { t.Start(); if (!t.Join(timeout)) { t.Abort(); return new TimeoutException(); } return null; }