Threads will deadlock like this:
// Thread 1 | // Thread 2
let _rg1 = lock.read(); |
| // will block
| let _wg = lock.write();
// may deadlock |
let _rg2 = lock.read(); |
Example from Rust std docs
Currently it is allowed to run multiple queries and do multiple operations on entities in one system (one thread). This could lead to the deadlock example from above. To prevent this, the work could internally be put into another thread, so only one operation is done per thread. This wouldn't touch the user-facing API.
Threads will deadlock like this:
Example from Rust std docs
Currently it is allowed to run multiple queries and do multiple operations on entities in one system (one thread). This could lead to the deadlock example from above. To prevent this, the work could internally be put into another thread, so only one operation is done per thread. This wouldn't touch the user-facing API.