Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : CookieManager thread safety
| Subject: | CookieManager thread safety |
| Posted by: | "dk_sz" (dk_..@hotmail.com) |
| Date: | Sun, 7 May 2006 16:15:56 |
I have encountered one practical and one theoretical problem.
I create a cookie manager and then assign it to
all TidHttps (which are run/owned by worker threads) ...
I have been running dozens of tests this week. On some
projects (long time running, many threads / connections)
I would consistently get access violations when doing :
" cookiemanager.free -> inherited -> free notifications... "
(obviously there should be nothing to notify as
all TidHttps instances are long gone... BUT...)
Anyways, I then added:
"
destructor TIdCustomHTTP.Destroy;
begin
Sys.FreeAndNil(FHTTPProto);
Sys.FreeAndNil(FURI);
Sys.FreeAndNil(FProxyParameters);
//>>
if Assigned(FCookieManager) then
FCookieManager.RemoveFreeNotification(Self);
//>>
inherited Destroy;
end;
"
which /seemed/ to solve that problem...
Anyways... That made me puzzle... The whole
free / notification system isn't thread safe is it?
Does not look like it at least... It all comes down to:
"
function TList.Remove(Item: Pointer): Integer;
begin
Result := IndexOf(Item);
if Result >= 0 then
Delete(Result);
end;
"
And that isn't thread safe...! AFAICS...!
Is this already solved in snapshot or...?
(I am using 10.1.5)
best regards
Thomas Schulz