The audience of this addon will probably be unfamiliar with the pitfalls of locking. In order to help prevent devs from accidentally causing deadlocks in their programs, multi-lock acquisition by a single process (browser tab) will be prohibited by default. A parameter will be added to the lock acquisition mechanism that enables the acquisition of the lock, even when other locks are already being held.
Should be easy enough -- just set a global-ish variable at the start of criticalSection and unset that variable in a finally block at the end of criticalSection -- then check for that global variable before the other X and Y checks.