Skip navigation

Its a bit weird, but IDXGIKeyedMutex::AcquireSync has a parameter called Key. The docs state:

Key [in]
Type: UINT64

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.

Observations:

  • – 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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: