Re: TIdSchedulerOfThreadPool Access Violation (Indy10 + Supercore)

Giganews Newsgroups
Subject: Re: TIdSchedulerOfThreadPool Access Violation (Indy10 + Supercore)
Posted by:  dumb (sitemast…@NOSPAMgmx.li)
Date: Thu, 28 Apr 2005

Did anybody take a look at this problem?

"dumb" <sitemast…@NOSPAMgmx.li> wrote in message
news:BD746CAA77C8E240sitemast…@NOSPAMgmx.li...
> The following example cause the AV. Drop TIdCmdTCPServer at form, link
> with TIdSchedulerOfThreadPool (PoolSize := 5), start server, stop server,
> you get AV. Tracking it down goes to
>
> procedure TIdSchedulerOfThreadPool.TerminateAllYarns;
> begin
>  // inherited will kill off ActiveYarns
>  inherited;
>  // ThreadPool is nil if never Initted
>  if FThreadPool <> nil then begin
>    // Now we have to kill off the pooled threads
>    with FThreadPool.LockList do try
>      while Count > 0 do begin
>        with TIdThreadWithTask(Items[0]) do begin
>          Terminate;
>          Resume;
>          WaitFor;
>          Free;
>        end;
>        Delete(0);
>      end;
>    finally FThreadPool.UnlockList; end;
>  end;
> end;
>
> It successfully kills 4 threads, then 5th thread causes the AV.
>
> Thanks.

Replies

In response to

TIdSchedulerOfThreadPool Access Violation (Indy10 + Supercore) posted by dumb on Tue, 26 Apr 2005