ShellBrowser Delphi Components Documentation
ContentsIndexHome
PreviousUpNext
Jam.Threading.TJamInterlocked.EnsureInitialized
Syntax
Pascal
class function EnsureInitialized<T: IInterface>(var pIntf: T; pFactoryMethod: TFunc<T>): Boolean; overload; static;
Parameters 
Description 
var pIntf: T 
The interface variable or member that should be initialized. 
pFactoryMethod: TFunc<T> 
A method that createws and returns an instance of pInf. The method is called when pIntf is nil. 

True if an instance was created, False if pVar was already assigned.

If pIntf is nil, an instance is created by calling pFactoryMethod and assigned to pVar. This is done in a threadsafe way.