Skip to content

fix deadlock

Christoph Haag requested to merge locking_fix into master

The first commit solves a deadlock on the OpenVR backend.

The cause of the problem is that

  1. device models (lighthouses, but also controllers etc) are initialized from the xrdesktop rendering thread on WaitGetPoses(), locked by the xrdesktop render lock, also locked by the gxr device manager lock, causing rendering work locked by the xrdesktop render lock (the xrdesktop mutex is recursive/reentrant for that reason)
  2. controller models are initialized from the xrdesktop main thread (previously locked by the xrdesktop render lock), when polling for action updates, locked by the gxr device manager lock, and down the line causing rendering work locked by the xrdesktop render lock.

The render lock around the action poll was an oversimplification intended as sort of a global "all rendering work caused by input events" lock, which would require some refactoring to correctly pull off. I suggest we do this on the next branch.

Merge request reports