>The only improvement I could see here would be to add a verification as you mentioned such as this:
>
>> If oApp.lFirstHit Then
> oApp.lFirstHit = False
>
> If Not oApp.lInitialize Then
> SyncLock oApp.oObjectLock
> If Not oApp.lInitialize Then
>
> If Not LoadDataDictionary() Then
> Return False
> End If
>
>
>So, basically, it would avoid using SyncLock if the application has been initialized.
>
>Is this more into what you were trying to explain me?Yes, that *is* what I meant by the double-check locking pattern (by checking first, you only get the lock if you need to) .... however, it seems to me that if you implement this pattern, then there's no reason that you even need to check both oApp.lFirstHit and oApp.lInitialize, is there? I mean, you're initializing only on the FirstHit anyway, so I would think you could simplify this to just the following:
If Not oApp.lInitialize Then
SyncLock oApp.oObjectLock
If Not oApp.lInitialize Then
If Not LoadDataDictionary() Then
Return False
End If
And then you could totally remove the lFirstHit property from oApp (unless you're using it for something else also).
~~Bonnie