harmony-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Magnusson, Geir" <geir.magnus...@intel.com>
Subject RE: [Fwd: [classlib][NIO|VMI]Interruptible channel implementation - how to interact with Thread?]
Date Wed, 14 Jun 2006 15:16:46 GMT

This font is getting out of hand...

> -----Original Message-----
> From: Tim Ellison [mailto:t.p.ellison@gmail.com] 
> Sent: Wednesday, June 14, 2006 11:12 AM
> To: harmony-dev@incubator.apache.org
> Subject: Re: [Fwd: [classlib][NIO|VMI]Interruptible channel 
> implementation - how to interact with Thread?]
> 
> Geir Magnusson Jr wrote:
> > Given that you are blocked, why is it in an unknown state?
> 
> The problem is that you typically don't know whether the thread is
> actually blocked or not.  So if it is really blocked then, yes,
> interrupting it may leave the channel safe for future 
> operations, but if
> it were blocked and then you interrupted it just after it 
> awoke and was
> reading/writing data then who knows what state you have left 
> the OS in.
> 
> Since different OS'es behave differently to interrupting IO operations
> in-flight then saying the channel is invalidated by 
> interruptions is the
> safe option.
> 
> (Note that if you interrupt a thread that is nowhere near a channel
> operation the thread will be marked as interrupted, and if it 
> should go
> on to attempt a Channel operation then it causes the channel to be
> closed! D'oh!)

I realize you may not be able to answer this... This is really just
interesting learning for me as I've never used NIO in anger...

Given that NIO is an advanced API, why would the NIO EG let the channel
user simply decide?  If you were interrupted while blocked on the
channel, you must close.  If not, you can use it...

Geir


> 
> > Doesn't the channel know that it didn't complete what
> > it was trying to do?
> 
> Yep, it gets the exception thrown that shows things were interrupted.
> 
> Regards,
> Tim
> 
> -- 
> 
> Tim Ellison (t.p.ellison@gmail.com)
> IBM Java technology centre, UK.
> 
> ---------------------------------------------------------------------
> Terms of use : http://incubator.apache.org/harmony/mailing.html
> To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
> For additional commands, e-mail: harmony-dev-help@incubator.apache.org
> 

---------------------------------------------------------------------
Terms of use : http://incubator.apache.org/harmony/mailing.html
To unsubscribe, e-mail: harmony-dev-unsubscribe@incubator.apache.org
For additional commands, e-mail: harmony-dev-help@incubator.apache.org


Mime
View raw message