General purpose library for delegation locking