TROInMemorySessionManager.Critical

Hi,

We upgraded to a newer version of DataAbstract/Remoting SDK running under Delphi 11.1
In our project we use the TROInMemorySessionManager.
In the older versions of DataAbstract this class had a property Critical.
It’s no longer available in the new version.

We used it for example this way:

SessionManager.Critical.Enter;
try
  SessionManager.GetAllSessions(list);
  ....
  ......
finally
  SessionManager.Critical.Leave;
end;

Is it safe to replace it with Delphi’s System.TMonitor ?
→ System.TMonitor.Enter(SessionManager) & System.TMonitor.Exit(SessionManager)

Freddy

Hi,

all public methods of TROInMemorySessionManager are thread-safe.

for example:

function TROCustomSessionManager.GetAllSessions: TROSessionIDs;
begin
  CreateTimerByRequest;
  LockForReading;    /// <------ protection
  try
    Result := DoGetAllSessionsIDs;
  finally
    UnlockForReading;    /// <------ protection
  end;
end;

yes. delphi code itself uses this feature:

procedure TSimpleRWSync.BeginRead;
begin
  MonitorEnter(FLock);
end;

procedure TSimpleRWSync.EndRead;
begin
  MonitorExit(FLock);
end;