private void ThreadProc() { while (thread != null) { try { waitEvent.WaitOne(); if (thread != null && item != null) { item.Callback(item.State); } } // ReSharper disable once EmptyGeneralCatchClause catch (Exception ex) { ThreadPool.OnUnhandledThreadPoolException(Item, ex); } if (thread != null) { waitEvent.Reset(); item = null; IsBusy = ThreadPool.NotifyThreadIdle(this); } } }
internal static void OnUnhandledThreadPoolException(ThreadPoolItem item, Exception exception) { var tmp = UnhandledThreadPoolException; if (tmp != null) { tmp(item.State, exception); } }