[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why to interrupt blocked socket? - Re: No message for 6 months
> Why do you let any thread be block at any socket, more accurately,
> at any stream? To avoid being blocked, Method available() of the
> stream should be called before read(XXX) in a synchronized method
> or block.
If you do that, what do you do if available() returns false? All Rick
wants to do - I suspect - is do nothing until either the read becomes
available or told to quit (e.g. a timeout or another channel event).
Using available() means setting up a polling loop - which is not nice!
What Rick needs - I suspect - is an ALT, which waits passively for
the read or quit event.