Skip to content

Latest commit

 

History

History
116 lines (96 loc) · 3.08 KB

nf-oleauto-safearraylock.md

File metadata and controls

116 lines (96 loc) · 3.08 KB
UID title description helpviewer_keywords old-location tech.root ms.assetid ms.date ms.keywords req.header req.include-header req.target-type req.target-min-winverclnt req.target-min-winversvr req.kmdf-ver req.umdf-ver req.ddi-compliance req.unicode-ansi req.idl req.max-support req.namespace req.assembly req.type-library req.lib req.dll req.irql targetos req.typenames req.redist ms.custom f1_keywords dev_langs topic_type api_type api_location api_name
NF:oleauto.SafeArrayLock
SafeArrayLock function (oleauto.h)
Increments the lock count of an array, and places a pointer to the array data in pvData of the array descriptor.
SafeArrayLock
SafeArrayLock function [Automation]
_oa96_SafeArrayLock
automat.safearraylock
oleauto/SafeArrayLock
automat\safearraylock.htm
automat
cb29d862-c7c5-4852-b017-c29e88d5f1c4
12/05/2018
SafeArrayLock, SafeArrayLock function [Automation], _oa96_SafeArrayLock, automat.safearraylock, oleauto/SafeArrayLock
oleauto.h
Windows
OleAut32.lib
OleAut32.dll
Windows
19H1
SafeArrayLock
oleauto/SafeArrayLock
c++
APIRef
kbSyntax
DllExport
OleAut32.dll
SafeArrayLock

SafeArrayLock function

-description

Increments the lock count of an array, and places a pointer to the array data in pvData of the array descriptor.

-parameters

-param psa [in]

An array descriptor created by SafeArrayCreate.

-returns

This function can return one of these values.

Return code Description
S_OK
Success.
E_INVALIDARG
The argument psa is not valid.
E_UNEXPECTED
The array could not be locked.

-remarks

The pointer in the array descriptor is valid until the SafeArrayUnlock function is called. Calls to SafeArrayLock can be nested, in which case an equal number of calls to SafeArrayUnlock are required.

An array cannot be deleted while it is locked.

Thread Safety

All public static (Shared in Visual Basic) members of the SAFEARRAY data type are thread safe. Instance members are not guaranteed to be thread safe.

For example, consider an application that uses the SafeArrayLock and SafeArrayUnlock functions. If these functions are called concurrently from different threads on the same SAFEARRAY data type instance, an inconsistent lock count may be created. This will eventually cause the SafeArrayUnlock function to return E_UNEXPECTED. You can prevent this by providing your own synchronization code.