SpreadsheetGear
ReleaseLock Method
See Also  Example Send Feedback
SpreadsheetGear Namespace > IWorkbookSet Interface : ReleaseLock Method

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

Syntax

Visual Basic (Declaration) 
Sub ReleaseLock() 
C# 
void ReleaseLock()

Example

Demonstrate using a workbook set in a thread safe manner.
C#Copy Code
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 BasicCopy Code
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

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:

  • The last lock acquired by the current thread is being released.
  • There are no other threads waiting to acquire a lock on this workbook set.
  • BackgroundCalculation is set to true.
  • Calculation is not set to Calculation.Manual.

Requirements

Platforms: x86 and x64 versions of Windows 2000, Windows XP, Windows Vista, Windows 7, Windows Server 2003 (including R2) and Windows Server 2008 (including R2). SpreadsheetGear 2009 requires the Microsoft .NET Framework 2.0 and supports .NET 3.0 and .NET 3.5.

See Also

Copyright © 2003-2009 SpreadsheetGear LLC. All Rights Reserved.Help Powered by Innovasys   
SpreadsheetGear is a registered trademark of SpreadsheetGear LLC.
Microsoft, Microsoft Excel and Visual Studio are trademarks or registered trademarks of Microsoft Corporation.