Esempio n. 1
0
        public AuctionActor(Fiber fiber, FiberScheduler scheduler, DateTime expiresAt, decimal openingBid, decimal bidIncrement)
        {
            _fiber = fiber;
            _scheduler = scheduler;
            _expiresAt = expiresAt;
            _openingBid = openingBid;
            _bidIncrement = bidIncrement;
            _highestBid = openingBid - bidIncrement;

            BidChannel = new ConsumerChannel<Bid>(_fiber, ReceiveBid);
            AskChannel = new ConsumerChannel<Ask>(_fiber, ReceiveAsk);

            scheduler.Schedule(expiresAt.ToUniversalTime() - SystemUtil.UtcNow, _fiber, EndAuction);
        }
 public void Init()
 {
     scheduler = SystemFiberScheduler.StartNew();
 }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="SpicyPixel.Threading.Tasks.FiberTaskScheduler"/> class.
 /// </summary>
 /// <remarks>
 /// Derived classes should invoke EnableQueueTask() in their constructor when ready to begin executing
 /// tasks.
 /// </remarks>
 public FiberTaskScheduler(FiberScheduler scheduler)
 {
     this.scheduler = scheduler == null ? FiberScheduler.Current : scheduler;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SpicyPixel.Threading.Tasks.FiberTaskScheduler"/> class.
 /// </summary>
 /// <remarks>
 /// Derived classes should invoke EnableQueueTask() in their constructor when ready to begin executing
 /// tasks.
 /// </remarks>
 public FiberTaskScheduler(FiberScheduler scheduler)
 {
     this.scheduler = scheduler;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SpicyPixel.Threading.Tasks.FiberTaskScheduler"/> class.
 /// </summary>
 /// <remarks>
 /// Derived classes should invoke EnableQueueTask() in their constructor when ready to begin executing
 /// tasks.
 /// </remarks>
 public FiberTaskScheduler(FiberScheduler scheduler)
 {
     this.scheduler = scheduler == null ? FiberScheduler.Current : scheduler;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="SpicyPixel.Threading.Tasks.FiberTaskScheduler"/> class.
 /// </summary>
 /// <remarks>
 /// Derived classes should invoke EnableQueueTask() in their constructor when ready to begin executing
 /// tasks.
 /// </remarks>
 public FiberTaskScheduler(FiberScheduler scheduler)
 {
     this.scheduler = scheduler;
 }
 public void Init()
 {
     scheduler = SystemFiberScheduler.StartNew();
 }