CoDecrementMTAUsage function (combaseapi.h)

Releases the increment made by a previous call to the CoIncrementMTAUsage function.

Syntax

HRESULT CoDecrementMTAUsage(
  [in] CO_MTA_USAGE_COOKIE Cookie
);

Parameters

[in] Cookie

A PVOID variable that was set by a previous call to the CoIncrementMTAUsage function.

Return value

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

Remarks

Cookie must be a valid value returned by a successful previous call to the CoIncrementMTAUsage function. If the overall count of MTA usage reaches 0, including both through this API and through the CoInitializeEx and CoUninitialize functions, the system frees resources related to MTA support.

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

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

Requirements

Requirement Value
Target Platform Windows
Header combaseapi.h
Library Ole32.lib
DLL Ole32.dll

See also

CoIncrementMTAUsage