Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IW 15.1.x+ gSessions.Execute Q&A
#1
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:

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
Reply


Messages In This Thread
IW 15.1.x+ gSessions.Execute Q&A - by DanBarclay - 08-01-2019, 07:45 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)