private static void RunAction(object param) { TaskItem item = (TaskItem)param; try { item.Execute(); item.Dispose(); } catch { } finally { item.Dispose(); Interlocked.Decrement(ref numThreads); } }