1. Figure out how the program works.
2. Without changing the T1 and T2 classes, make it so their threads finish (not necessarily successfully).
3. Don't use the sleep method.
Deadlock
- 4
Locked
Comments (1)
- Popular
- New
- Old
You must be signed in to leave a comment
aijo
12 February 2022, 10:06
The code below allows both threads to finish (and is accepted as a solution to this task) - could anyone please help me understand why?
Is t2.join() in T1 immediately satisfied because t2 was not yet started?
If so, then I avoided the deadlock by making the threads work sequentially...which shouldn't be really accepted as a correct solution, I think. But I'm just guessing here :)
0