[concurrency-interest] Basic question on making a thread waiting for 2 mailboxes...

Gregg Wonderly gregg at cytetech.com
Mon Apr 23 12:43:44 EDT 2007



Peter Veentjer wrote:
> But as far as I know there is no synchronization structure in j.u.c
> that can provide the same functionality for arbitrary event sources.
> 
> On 4/23/07, Fred Janon <fjanon at gmail.com> wrote:
> 
>>Hi,
>>
>>I used to write real time apps using RSX11M+ (and VMS) that had mailboxes
>>and events. There was a "wait for OR(events)". The task would wait for any
>>event specified in the OR. Then I would associate an event with a mailbox,
>>do that for another mailbox and when a message would arrive in one of the 2
>>mailboxes, the task would awake. I am trying to do that in Java with
>>threads.

What I would do, is use threads that read from the two queues and put the 
objects into a single queue that you can take from.

Gregg Wonderly


More information about the Concurrency-interest mailing list