natObject.cc (notify): Throw message with IllegalMonitorStateException.

1999-12-22  Bryce McKinlay  <bryce@albatross.co.nz>

        * java/lang/natObject.cc (notify): Throw message with
        IllegalMonitorStateException.
        (notifyAll): Ditto.
        (wait): Ditto.
        * java/lang/Thread.java (isInterrupted): Don't clear interrupt_flag.
        (isInterrupted_): New function, which does clear interrupt_flag.
        (interrupt): Use `isInterrupted_'.
        * java/lang/natThread.cc (interrupt): Add comment.
        (join): Set `Prev' in joiner loop.
        Change various calls to `isInterrupted' to use `isInterrupted_'.
        * posix-threads.cc (_Jv_CondWait): Allways use pthread_cond_timedwait
        on linux. Set result to 0 on an interrupt. Test interrupted status
        of java Thread object directly.
        FLAG_INTERRUPTED: removed.
        (_Jv_ThreadStart): Throw OutOfMemoryError if pthread_create fails.
        (_Jv_ThreadInterrupt): Don't set FLAG_INTERRUPTED.
        (_Jv_InitThreads): Don't block SIGINT.
        (_Jv_ThreadWait): Don't configure SIGINT handler.

From-SVN: r31082
This commit is contained in:
Bryce McKinlay 1999-12-24 01:00:46 +00:00 committed by Bryce McKinlay
parent 07875628ee
commit 43cbc9430d
4 changed files with 108 additions and 64 deletions

View file

@ -175,7 +175,8 @@ java::lang::Object::notify (void)
sync_init ();
_Jv_SyncInfo *si = (_Jv_SyncInfo *) sync_info;
if (_Jv_CondNotify (&si->condition, &si->mutex))
JvThrow (new IllegalMonitorStateException);
JvThrow (new IllegalMonitorStateException(JvNewStringLatin1
("current thread not owner")));
}
void
@ -185,7 +186,8 @@ java::lang::Object::notifyAll (void)
sync_init ();
_Jv_SyncInfo *si = (_Jv_SyncInfo *) sync_info;
if (_Jv_CondNotifyAll (&si->condition, &si->mutex))
JvThrow (new IllegalMonitorStateException);
JvThrow (new IllegalMonitorStateException(JvNewStringLatin1
("current thread not owner")));
}
void
@ -197,7 +199,8 @@ java::lang::Object::wait (jlong timeout, jint nanos)
JvThrow (new IllegalArgumentException);
_Jv_SyncInfo *si = (_Jv_SyncInfo *) sync_info;
if (_Jv_CondWait (&si->condition, &si->mutex, timeout, nanos))
JvThrow (new IllegalMonitorStateException);
JvThrow (new IllegalMonitorStateException(JvNewStringLatin1
("current thread not owner")));
if (Thread::interrupted())
JvThrow (new InterruptedException);
}