GridGain Interview Question

Implement a reentrant lock based on a CAS primitive.