A switch for threads

  • 14
  • Locked
Process the list of threads depending on their state: 1. If the thread isn't running yet, then start it. 2. If the thread is waiting, then interrupt it. 3. If the thread is running, check the isInterrupted flag. 4. If the thread has stopped running, then display its priority on the console.
You can't complete this task, because you're not signed in.
Comments (2)
  • Popular
  • New
  • Old
You must be signed in to leave a comment
Justin Smith
Level 38 , Greenfield, USA, United States
18 January 2022, 14:56
Bug in validation that has to be addressed: When you do the isInterrupted() check... if you print the result, it will fail validation for the next condition in the list of tasks. So you'll be looking for errors for the TERMINATED state when the error is actually in the RUNNABLE state.
Jurij Thmsn
Level 29 , Flensburg, Germany
2 November 2021, 10:55
Condition 2 should say: If the thread is non-Runnable, interrupt it.