This was a question as part of the onsite - I haven't been able to come up with an optimal solution for this yet.
Write an API to lock a range on the number line
void rlock(int low, int high)
boolean runlock(int low, int high) //Must unlock exactly what has been lockedeg:
T1:rlock(1,3)
T2: rlock(2,4) --> Wait
T2:rlock(1,3)
T1: runlock(1,3) --> Signal waiters