Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Java Programmer > In Mutex.aquire...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 5 Topic 52654 of 53449
Post > Topic >>

In Mutex.aquire why do we need to throw InterruptedException

by puzzlecracker <ironsel2000@[EMAIL PROTECTED] > May 11, 2008 at 03:13 PM

It is a copy and paste from Doug Lea's Mutex implementation. I dont
understand the point of this line:
    if (Thread.interrupted()) throw new InterruptedException();


  public void acquire() throws InterruptedException {
    if (Thread.interrupted()) throw new InterruptedException();
    synchronized(this) {
      try {
        while (inuse_) wait();
        inuse_ = true;
      }
      catch (InterruptedException ex) {
        notify();
        throw ex;
      }
    }
  }


Thx
 




 5 Posts in Topic:
In Mutex.aquire why do we need to throw InterruptedException
puzzlecracker <ironsel  2008-05-11 15:13:10 
Re: In Mutex.aquire why do we need to throw InterruptedException
=?ISO-8859-1?Q?Arne_Vajh=  2008-05-11 18:24:39 
Re: In Mutex.aquire why do we need to throw InterruptedException
Logan Shaw <lshaw-usen  2008-05-11 19:51:45 
Re: In Mutex.aquire why do we need to throw InterruptedException
=?ISO-8859-1?Q?Arne_Vajh=  2008-05-11 21:24:59 
Re: In Mutex.aquire why do we need to throw InterruptedException
Szabolcs Ferenczi <sza  2008-05-12 08:49:27 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Jul 5 19:40:22 CDT 2008.