IUnknown_AtomicRelease function (shlwapi.h)
Releases a Component Object Model (COM) pointer and sets it to NULL.
Syntax
void IUnknown_AtomicRelease(
[in, out, optional] void **ppunk
);
Parameters
[in, out, optional] ppunk
Type: void**
The address of a pointer to a COM interface.
Return value
None
Remarks
If ppunk points to a NULL pointer, no operation is performed. Otherwise, ppunk is assumed to be the address of a COM interface pointer, derived from IUnknown. The function calls the interface's IUnknown::Release method then sets the interface pointer to NULL.
Examples
The following example uses IUnknown_AtomicRelease to release the stream, if it exists. If not, it does nothing.
void sample()
{
IStream *pstm = NULL;
CreateStreamOnHGlobal(NULL, TRUE, &pstm);
IUnknown_AtomicRelease((void**)&pstm);
// At this point, pstm is NULL
}
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional, Windows XP [desktop apps only] |
Minimum supported server | Windows 2000 Server, Windows Server 2003 [desktop apps only] |
Target Platform | Windows |
Header | shlwapi.h |
DLL | Shlwapi.dll (version 5.0 or later) |