I'd like to check if my reasoning is correct.
First of all, I should provide a few details about the problem I'm trying to solve. A thread (part of a program) does the following things:
- it starts
- it calls Thread.sleep (20ms)
- it calls getIn() method
- it tries to get a lock (lock.lock())
- if successfully gets the lock it calls Thread.sleep (100ms)
- if the lock is not available it calls waitingCond.await()
- after calling Thread.sleep (100ms) it calls lock.unlock()
- it calls another method getOut()
- it terminates (thread.join())
Given that, the following is my guessing about the thread state:
READY TO RUN
stateTIMED WAITING
stateWAITING
stateWAITING
stateBLOCKED
stateWAITING
stateWAITING
stateTERMINATED
state
Thanks