コード例 #1
0
        /// <summary>
        /// Resume the given <see cref="DesTask"/> using an interrupt.
        /// </summary>
        /// <param name="desTask">The <see cref="DesTask"/> to interrupt.</param>
        /// <param name="activator">The interruptor object.</param>
        /// <param name="data">Not used.</param>
        protected override void ResumeTask(DesTask desTask, object activator,
                                           object data)
        {
            // DO NOT INVOKE THE BASE CLASS IMPLEMENTATION!

            System.Diagnostics.Debug.Assert(Interruptor == activator);
            desTask.Interrupt(activator);
        }
コード例 #2
0
        /// <summary>
        /// Transfers ownership of a DESResource item to another <see cref="DesTask"/>.
        /// </summary>
        /// <param name="activator">
        /// The current owner of the DESResource item.
        /// </param>
        /// <param name="data">Not used.</param>
        protected override void ExecuteTask(object activator, object data)
        {
            DesTask owner = activator as DesTask;

            if (owner == null)
            {
                throw new ArgumentException("'activator' not a DesTask instance.");
            }
            Blocker.TransferResource(owner, _receiver, _itemToTransfer);
            ResumeAll(Blocker, null);
        }
コード例 #3
0
 /// <summary>
 /// Create a new <see cref="TransferResource"/> DesTask that will transfer
 /// a specific DESResource item to the given receiver.
 /// </summary>
 /// <param name="sim">The simulation context.</param>
 /// <param name="desResource">
 /// The <see cref="DESResource"/> containing the item to transfer to
 /// <paramref name="receiver"/>.
 /// </param>
 /// <param name="receiver">
 /// The <see cref="DesTask"/> which will become the new owner of an item
 /// contained in <paramref name="desResource"/>.
 /// </param>
 /// <param name="item">
 /// The DESResource item to transfer.  This should be <see langword="null"/>
 /// for anonymous resources.
 /// </param>
 public TransferResource(Simulation sim, DESResource desResource,
                         DesTask receiver, object item) : base(sim, desResource)
 {
     _receiver       = receiver;
     _itemToTransfer = item;
 }
コード例 #4
0
 /// <summary>
 /// Create a new <see cref="TransferResource"/> DesTask that will transfer
 /// a DESResource item to the specified receiver.
 /// </summary>
 /// <param name="sim">The simulation context.</param>
 /// <param name="desResource">
 /// The <see cref="DESResource"/> containing the item to transfer to
 /// <paramref name="receiver"/>.
 /// </param>
 /// <param name="receiver">
 /// The <see cref="DesTask"/> which will become the new owner of an item
 /// contained in <paramref name="desResource"/>.
 /// </param>
 public TransferResource(Simulation sim, DESResource desResource, DesTask receiver)
     : this(sim, desResource, receiver, null)
 {
 }