Skip to content

Thread Safety

MaulingMonkey edited this page Feb 18, 2024 · 1 revision

...XAudio2 might be beholden to the monster that is COM's threading model.

XAudio 2.7

  • CLSID_XAudio2HKEY_CLASSES_ROOT\CLSID\{5a508685-a254-4fba-9b82-9a24b00306af}\InProcServer32\ThreadingModel = Both
    • Resulting COM objects can only be accessed from within the same apartment (means we can't Send from MTASTA)
    • If we can forcibly create the class in the neutral apartment, that might suffice to make things Sendable?

XAudio 2.9

  • No CLSID, and creation can succeed without COM being initialized (although doing much still requires COM init)
  • It's possible to create and use IXAudio2 s from both single threaded and multi-threaded apartments
  • No thread safety hinting interfaces are implemented (e.g. IAgileObject, IMarshal, INoMarshal, ...)

References

The Old New Thing:

Clone this wiki locally