08-01-2019, 07:45 PM
(This post was last modified: 08-01-2019, 09:03 PM by Jose Nilton Pace.)
Finally upgrading to 15.1.2, I've got some questions (based on some assumptions) about dealing with session lists.
One thing I do occasionally is rip through the sessions to gather status information, including some app specific data from UserSession.
Questions regarding gSessions.Execute():
1. Is it safe to read data from UserSession? (form xx:=TIWUserSession(LSession.Data).MyValue)
2. Is it safe to write data to UserSession? (form TIWUserSession(LSession.Data).MyFlag:=true)
3. Do I need to lock the session, or does the gSessions.Execute() lock before calling the procedure?
I do know that this kind of procedure works (see snip below), just converting from the SessionList demo, but:
Is this kind of cross session (UserSession access) safe?
Is the session.lock redundant?
I finally got back to work on some IW stuff so am upgrading, but my source access isn't turned on yet so I don't know what's behind the .execute curtain.
Thanks,
Dan
One thing I do occasionally is rip through the sessions to gather status information, including some app specific data from UserSession.
Questions regarding gSessions.Execute():
1. Is it safe to read data from UserSession? (form xx:=TIWUserSession(LSession.Data).MyValue)
2. Is it safe to write data to UserSession? (form TIWUserSession(LSession.Data).MyFlag:=true)
3. Do I need to lock the session, or does the gSessions.Execute() lock before calling the procedure?
I do know that this kind of procedure works (see snip below), just converting from the SessionList demo, but:
Code:
gSessions.Execute(LSessionList[i],
procedure(aSession: TObject)
var
LSession: TIWApplication absolute aSession;
begin
LSession.Lock;
try
xx:=TIWUserSession(LSession.Data).MyValue;
// etc
finally
LSession.Unlock;
end;
end;);
Is this kind of cross session (UserSession access) safe?
Is the session.lock redundant?
I finally got back to work on some IW stuff so am upgrading, but my source access isn't turned on yet so I don't know what's behind the .execute curtain.
Thanks,
Dan