SpreadsheetGear 2012
ReleaseLock Method (IWorkbookSet)
Example 






Releases a lock acquired with IWorkbookSet.GetLock and starts background calculation if appropriate.
Syntax
'Declaration
 
Sub ReleaseLock() 
'Usage
 
Dim instance As IWorkbookSet
 
instance.ReleaseLock()
void ReleaseLock()
procedure ReleaseLock(); 
function ReleaseLock();
void ReleaseLock(); 
void ReleaseLock(); 
Remarks

This method is thread safe.

Calls to IWorkbookSet.GetLock may be nested. IWorkbookSet.ReleaseLock must be called once for each call to GetLock.

Interruptible background calculation will be started if the following conditions are all met:

Example
Demonstrate using a workbook set in a thread safe manner.
void DoSomeThreadSafeWork(IWorkbookSet workbookSet)
        {
            // Interrupt background calculation if necessary and acquire an
            // exclusive lock on the workbook set.
            workbookSet.GetLock();
 
            try {
                // Do some work...
            }
            finally {
                // Release the lock on the workbook set and start background
                // calculation if appropriate.
                workbookSet.ReleaseLock();
            }
        }
Sub DoSomeThreadSafeWork(ByVal workbookSet As IWorkbookSet)
            ' Interrupt background calculation if necessary and acquire an 
            ' exclusive lock on the workbook set. 
            workbookSet.GetLock()
 
            Try
                ' Do some work... 
            Finally
                ' Release the lock on the workbook set and start background 
                ' calculation if appropriate. 
                workbookSet.ReleaseLock()
            End Try
        End Sub 'DoSomeThreadSafeWork
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

IWorkbookSet Interface
IWorkbookSet Members
HasLock Property
GetLock Method
ReleaseLock Method
RewindLock Method
UnwindLock Method
BeginUpdate Method
EndUpdate Method
BackgroundCalculation Property

Send Feedback