ordered-locks
A rust libary for assigning levels to locks at compiletime in order to avoid deadlocks.
use ;
// Create value at lock level 0, this lock cannot be acquired while a level1 lock is heldt
let v1 = new;
// Create value at lock level 1
let v2 = new;
// Construct a token indicating that this thread does not hold any locks
let mut token = unsafe ;
// Once the guards are dropped we can acquire other things
*v2.lock = 13;
// One cannot acquire locks in the wrong order
let mut g2 = v2.lock;
let = g2.token_split;
let mut g1 = v1.lock; // shouldn't compile!
*g2 = 11;
*g1 = 12;