Improve SynchronizationEvent

This commit is contained in:
Kelven Yang 2010-09-10 10:34:00 -07:00 committed by edison
parent 3f832c0c08
commit 4534299092
1 changed files with 4 additions and 3 deletions

View File

@ -45,7 +45,7 @@ public class SynchronizationEvent {
}
}
public boolean waitEvent() {
public boolean waitEvent() throws InterruptedException {
synchronized(this) {
if(signalled)
return true;
@ -57,12 +57,13 @@ public class SynchronizationEvent {
return signalled;
} catch (InterruptedException e) {
s_logger.debug("unexpected awaken signal in wait()");
throw e;
}
}
}
}
public boolean waitEvent(long timeOutMiliseconds) {
public boolean waitEvent(long timeOutMiliseconds) throws InterruptedException {
synchronized(this) {
if(signalled)
return true;
@ -73,7 +74,7 @@ public class SynchronizationEvent {
} catch (InterruptedException e) {
// TODO, we don't honor time out semantics when the waiting thread is interrupted
s_logger.debug("unexpected awaken signal in wait(...)");
return false;
throw e;
}
}
}