SpreadsheetGear 2023
GetLock and ReleaseLock
SpreadsheetGear 2023 > Tutorials > Key Concepts > GetLock and ReleaseLock

SpreadsheetGear 2023 includes interruptible background calculation which is enabled by default, making it responsive even when calculating large and complex models. SpreadsheetGear 2023 also supports applications which respond to events by updating workbook sets from a background thread as demonstrated by the Advanced -> Threading sample in the SpreadsheetGear Explorer Samples.

Efficiently supporting interruptible background calculation and changes in response to background events requires the use of GetLock and ReleaseLock anytime a workbook set will be accessed, to ensure that multiple threads are not accessing the workbook set at the same time.

It is important to note that background calculation will never be initiated unless GetLock and ReleaseLock are used. The Windows Forms and WPF WorkbookView controls call GetLock and ReleaseLock as needed, so applications which use a WorkbookView control must also use GetLock and ReleaseLock as needed unless background calculation is disabled. In applications which create their own workbook set, such as in ASP.NET applications, it is typical for only one thread to access a workbook set, and background calculation may or may not be beneficial.

See GetLock and ReleaseLock for more information.