Attempt to lock, and if successful, call dg() then unlock.
A scoped callback that is called only while this is locked.
Whether or not the lock was taken.
See Implementation
Attempt to lock, and if successful, call dg() then unlock.