This file could be patched more easily: if HPX_DEBUG is not defined (which controls what HPX_ASSERT does) you could leave just the 

    template <typename Lock>
    void assert_owns_lock(Lock&, int) {}

while not touching the code if HPX_DEBUG is defined.