priority queue - Channel input prioritization in Retlang -


How can input in the preferred fashion be controlled? Is there something similar to Scala's " reactionline (0) {... case TIMEOUT} " build?

I have written a membership class which sends priority message at set intervals. This is not an ideal general case to consume the message of priority, but I will post it for the posterity. I think a custom requestline channel would be a better option for some other cases. Implementation of the priority question is left to the reader as an exercise.

  Class Preferences Members & lt; T & gt; : BaseSubscription & lt; T & gt; {Private Readonly Priority Quiz & lt; T & gt; Queue; Private readonly isadular scheduler; Private Readonly Action & lt; T & gt; Receiving; Private only reading interval intervals; Private Readonly Object Sync = New Object (); Private ITimerControl next = null; Public Priority Member (ICPP player & lt; T & gt; Comparator, ISC Scheduler, Action & lt; T & gt; Received, Interval Interval) {this.queue = New Priority Question & lt; T & gt; (Comparison); This.scheduler = Scheduler; this. Received = received; This.interval = interval; } Safe Override Zero OnMessageOnProducerThread (T msg) {lock (this.sync) {this.queue.Enqueue (msg); If (this.next == faucet) {this.next = this.scheduler.Schedule (get it, this.interval); }}} Get Private Zero () {T msg; Lock (this.sync) {msg = this.queue.Dequeue (); If (this.queue.Count> 0) {this.next = this.scheduler.Schedule (Recipients, this.interval); }} This.receive (msg); }}  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -