Hi,
I'm looking at sorting out a few lock issues I'm having with some of our bigger/busiest classes.
Just wanting to confirm, I thought Jade made a change many moons ago, that if the key of a dictionary isn't changed, even if it's set again, the dictionary wasn't locked. But that doesn't look to be the case.
I made a silly little method that sets the key again (to itself) and one that sets the reference that adds it to the dictionary again (also to itself).
begin
aDeviceToken := aDeviceToken;
app.doWindowEvents(5000);
end;
and setting the reference:
begin
rRootObject := rRootObject;
app.doWindowEvents(5000);
end;
Note - the delay is just so I have time to click refresh on my monitor to view the locks.
Running both these methods, even though it is setting the value to itself, creates exclusive locks on the dictionaries involved. Screenshot is attached.
So it appears for any key or reference I should be doing something like:
if aDeviceToken <> deviceToken then
aDeviceToken := deviceToken;
endif;
Is this correct? - as mentioned I thought we no longer had to do that basic check but it appears we do.
Many thanks
Stephen