@charlesrchance do you need a lock at all?
https://github.com/tombeard/kamailio/commit/310c0f91858a6baf4b17a00798689f7f...
No idea how this performs on other platforms or in other situations, but for my specific requirement it solves the high cpu condition on FreeBSD waiting for lock yeild and I've had it running in production with dmq_usrloc for several months now without issue. Of course, your mileage may vary.