Example #1
0
 /// <summary>
 /// Attempt to acquire an item from a <see cref="Resource"/> on behalf
 /// of some client <see cref="Task"/>.
 /// </summary>
 /// <param name="activator">
 /// The object that activated this <see cref="AcquireResource"/> task.
 /// </param>
 /// <param name="data">
 /// Optional data for the <see cref="AcquireResource"/> task.  This will
 /// normally be <see langword="null"/> or the resource item.
 /// </param>
 protected override void ExecuteTask(object activator, object data)
 {
     System.Diagnostics.Debug.Assert(activator != Blocker);
     if (!_requestMade)
     {
         if (Client != null)
         {
             _requestMade = true;
             if (!Blocker.RequestResource(this) && MaxWait > 0)
             {
                 Activate(null, MaxWait, null, Priority);
             }
         }
     }
     else
     {
         ResumeAll();
     }
 }