* src/threads/thread.cpp (thread_set_state_*): Don't take the ThreadList
lock, most of the time.
We need the lock only when changing the state to terminated. This prevents
other threads from using a stale threadobject * (they have to take the lock,
of course). This changeset removes a nasty deadlock:
Thread 1 locks ThreadList::_mutex -> waitmutex (via thread_handle_interrupt
-> threads_thread_interrupt)
Thread 2 locks waitmutex -> ThreadList::_mutex (via
threads_wait_with_timeout -> thread_set_state_runnable)
The deadlock is provoked by running tests/threads/waitAndInterrupt.java (in
the CACAO source tree). The bug was introduced in changeset
a62d7ef60606 (PR
120).