SafeArrayUnlock
f90VB Modules
f90VBDefs, f90VBSafeArrays
Summary
Decreases the lock-counter of a Safe Array. A locked Safe Array cannot be redimensioned or destroyed.
Syntax
| subroutine SafeArrayUnlock | (SARef,iRet) |
| { | |
| integer(SAFEARRAY_KIND),intent(in):: | SARef | |
| type(FSafeArray),intent(in):: | SARef | |
| } | |
| integer(HRESULT_KIND),intent(out),optional:: | iRet |
Arguments
SARef [Input]
A handle to, or a Fortran Safe Array structure containing a handle to, an allocated Safe Array descriptor.
iRet [Output, Optional]
Upon return, iRet contains S_OK or an error code. See comments for more information.
Comments
Note that SARef must be a reference to an allocated Safe Array descriptor.
A Safe Array can be accessed at the same time by more than one program, thread or the operating system. You can use SafeArrayLock to prevent other threads and/or processes from changing the characteristics of a Safe Array or reallocating its data-block while you are using the array. Once you have finished using the array, you can issue a call to SafeArrayUnlock to decrease the lock-counter of an array. Calls to SafeArrayLock and SafeArrayUnlock must be paired, i.e. you must issue the same number of calls to SafeArrayLock and SafeArrayUnlock.
Most f90VB subroutines internally lock/unlock Safe Arrays as necessary, so SafeArrayUnlock seldom needs to be used. Subroutine SafeArrayAccessData also adds a lock to the array’s lock-counter, which is later released when you call SafeArrayUnAccessData.
Argument iRet
Indicates success or failure of the subroutine. The following codes can be returned in this argument:
| Value returned in argument iRet | Description | |
| S_OK | Success. | |
| E_UNEXPECTED | The array could not be unlocked. | |
| E_INVALIDARG | The item pointed to by SARef is not a Safe Array descriptor | |
Examples
See example for SafeArrayLock.
Related Topics
| For information about | See | |
| Creating a Safe Array | SafeArrayCreate | |
| Locking a Safe Array | SafeArrayLock | |
| Obtaining the lock-counter of a Safe Array | SafeArrayGetLocks | |
| Allocating a Safe Array descriptor | SafeArrayAllocDescriptor | |