|
Re: Prioritizing message handling in actors: msg#00473lang.scala
David Pollak wrote: Is there a way to prioritize message handling in Actors... basically, optionally drain all the "Foo" messages from the mailbox before handling any other messages or in other ways "look ahead" into the message queue? Using `receiveWithin'/`reactWithin' you can do some kind of look-ahead. The following function first removes all `Foo' messages from the mailbox and then returns (note the timeout of 0 in `receiveWithin'): def drainFoo() { receiveWithin(0) { case Foo => drainFoo() case TIMEOUT => // do nothing } } Prioritizing can be done in general using `receiveWithin'/`reactWithin'. Hope this helps. Philipp |
|
| <Prev in Thread] | Current Thread | [Next in Thread> |
|---|---|---|
| Previous by Date: | Re: Prioritizing message handling in actors: 00473, Steven Shaw |
|---|---|
| Next by Date: | Is the scala list getting too busy?: 00473, martin odersky |
| Previous by Thread: | Re: Prioritizing message handling in actorsi: 00473, Steven Shaw |
| Next by Thread: | Re: Prioritizing message handling in actors: 00473, David Pollak |
| Indexes: | [Date] [Thread] [Top] [All Lists] |
| News | FAQ | advertise |