Skip to content

Prevent deadlocks of RwLock by doing work in a seperate thread #26

@DynamicGoose

Description

@DynamicGoose

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.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingenhancementNew feature or request

Projects

Status

No status

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions