예제 #1
0
        /// <summary>
        /// Attempt to release an item to a <see cref="Resource"/> on behalf
        /// of some client <see cref="Task"/>.
        /// </summary>
        /// <exception cref="ArgumentException">
        /// If <paramref name="activator"/> is not a <see cref="Task"/>
        /// instance.
        /// </exception>
        /// <param name="activator">
        /// The object that activated this <see cref="ReleaseResource"/> task.
        /// </param>
        /// <param name="data">Not used.</param>
        protected override void ExecuteTask(object activator, object data)
        {
            Task owner = activator as Task;

            if (owner == null)
            {
                throw new ArgumentException("'activator' not a Task instance.");
            }
            Blocker.ReturnResource(owner, _itemToRelease);
            ResumeAll(Blocker, null);
        }