
2 Jun
2008
2 Jun
'08
10:01 p.m.
Johan Torp:
If I understand you correctly, it can deadlock.
It can deadlock, but it cannot deadlock unexpectedly. That is, it will not turn code that didn't deadlock into code that deadlocks. Your example:
Thread A, task 1, pool task: submit task 2 acquire M2 wait on task 2 // Surprising that this call would acquire locks
Thread A, task 2, executed from within wait on task 2 statement: acquire M1 // Acquired in wrong order
Thread X: // Acquires mutexes in correct order acquire M1 acquire M2
already deadlocks without reuse.