Datasnap.DataBkr.TCRemoteDataModule.Lock

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

procedure Lock; virtual;

C++

virtual void __fastcall Lock();

Properties

Type Visibility Source Unit Parent
procedure
function
public
Datasnap.DataBkr.pas
Datasnap.DataBkr.hpp
Datasnap.DataBkr TCRemoteDataModule

Description

Locks the remote data module so that it cannot be locked by other threads.

TCRemoteDataModule descendants use Lock internally to ensure that all TRemoteDataModule calls are thread-safe. When implementing a remote data module that supports the free-threading model, call Lock before accessing any instance data, including the providers contained in the data module. When finished with the block of code that must be protected from thread conflicts, call the UnLock method to release the lock.

Lock uses a critical section to guard against thread conflicts. This means that any code that accesses the remote data module's properties or contained objects must call Lock or it will introduce thread conflicts.

See Also