What does HRESULT 0x80010102 (RPC_E_ATTEMPTED_MULTITHREAD) mean?

 
Previous Next
RPC_E_OUT_OF_RESOURCES RPC_E_NOT_REGISTERED

RPC_E_ATTEMPTED_MULTITHREAD

RPC_E_ATTEMPTED_MULTITHREAD means that code attempted multithreaded use in a COM context that requires a single-threaded execution model. Directly sharing an apartment-bound interface pointer across threads is a typical cause.

How to correct the threading model

  • Keep STA-bound COM objects on their owning thread and dispatch work to that thread.
  • Marshal interfaces between apartments with the COM marshaling APIs or use the Global Interface Table where appropriate.
  • Do not assume COM synchronizes calls inside an MTA; free-threaded objects need their own locking.

Choose the apartment model deliberately at thread initialization and document which thread owns each COM interface.

Microsoft: COM documentation


Looking for a different code? Search another status or error code.