See Also

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

Requirements

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Language

Visual Basic

C#

C++

C++/CLI

Show All

See Also Languages SpreadsheetGear The Performance Spreadsheet Component Company 

ReleaseLock Method

SpreadsheetGear Namespace > IWorkbookSet Interface : ReleaseLock Method

Releases a lock acquired with GetLock and starts background calculation if appropriate.

[Visual Basic]
Overridable Sub ReleaseLock()
[C#]
virtual void ReleaseLock();
[C++]
virtual void ReleaseLock();
[C++/CLI]
virtual void ReleaseLock();

Remarks

This method is thread safe.

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

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

Example

[C#] 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(); 
            } 
        } 
    

[Visual Basic] 

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

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

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

 

 


See our live Excel Reporting, Excel Charting, Excel to DataGrid and Excel Calculation Samples.

Copyright © 2003-2007 SpreadsheetGear LLC. All Rights Reserved.

SpreadsheetGear and Spreadsheet Gear are trademarks of SpreadsheetGear LLC.