Its a bit weird, but IDXGIKeyedMutex::AcquireSync has a parameter called Key. The docs state:
A value that indicates which device to give access to. This method will succeed when the device that currently owns the surface calls the IDXGIKeyedMutex::ReleaseSync method using the same value. This value can be any UINT64 value.
- – The first AcquireSync call __Must__ be made on 0, otherwise the app hangs forever
- – If you Acquire on 0, and you release on 1, then the next person to pick up __must__ pick up on 1
Useful if ordering. Say A picks up the mutex on 0. Then, there are 2 objects B and C that must go in the order B, C. So:
– A PICKS UP 0, RELEASES on 1
– B picks up 1, releases 2
– C picks up 2, releases 0
Now they are going in a cycle, A,B,C,A,B,C…
C cannot go before B (because it will block until B releases on 2).
If you’re not ordering, you can just always use 0 for the key.