public static void WithLock <T>(ExclusiveLock @lock, Action <T> action, T state) { @lock.Lock(); try { action(state); } finally { @lock.Unlock(); } }
public static void WithLock <T>(ExclusiveLock @lock, Action <T> action) where T : class { WithLock(@lock, action, null); }