COM
Expand Minimize

CoIncrementMTAUsage function

Keeps MTA support active when no MTA threads are running.

Syntax


HRESULT WINAPI CoIncrementMTAUsage(
  _Out_  CO_MTA_USAGE_COOKIE *pCookie
);

Parameters

pCookie [out]

Address of a PVOID variable that receives the cookie for the CoDecrementMTAUsage function, or NULL if the call fails.

Return value

If this function succeeds, it returns S_OK. Otherwise, it returns an HRESULT error code.

Remarks

The CoIncrementMTAUsage function enables clients to create MTA workers and wait on them for completion before exiting the process.

The CoIncrementMTAUsage function ensures that the system doesn't free resources related to MTA support., even if the MTA thread count goes to 0.

On success, call the CoDecrementMTAUsage once only. On failure, don't call the CoDecrementMTAUsage function.

Don't call CoIncrementMTAUsage during process shutdown or inside dllmain. You can call CoIncrementMTAUsage before the call to start the shutdown process.

You can call CoIncrementMTAUsage from one thread and CoDecrementMTAUsage from another as long as a cookie previously returned by CoIncrementMTAUsage is passed to CoDecrementMTAUsage.

Requirements

Header

Combaseapi.h

See also

CoDecrementMTAUsage

 

 

Community Additions

ADD
Show:
© 2014 Microsoft