示例#1
0
 public void ExecuteInSemaphore(SemaphoreOptions opts, Action a)
 {
     if (opts == null)
     {
         throw new ArgumentNullException("opts");
     }
     if (a == null)
     {
         throw new ArgumentNullException("a");
     }
     using (var l = new AutoSemaphore(this, opts))
     {
         if (l.IsHeld)
         {
             a();
         }
     }
 }
示例#2
0
 public void ExecuteInSemaphore(SemaphoreOptions opts, Action a)
 {
     if (opts == null)
     {
         throw new ArgumentNullException("opts");
     }
     if (a == null)
     {
         throw new ArgumentNullException("a");
     }
     using (var l = new AutoSemaphore(this, opts))
     {
         if (l.IsHeld)
         {
             a();
         }
     }
 }