Draft: Add a deadlock helper and test it.
This allows applications to debug when deadlocks occur due to resource locking by providing a callback just before a lock() is attempted. Since lock() is blocking, this can print debug info before the deadlock.