[fpc-pascal] Is THostResolver creating a thread?

silvioprog silvioprog at gmail.com
Wed May 8 06:07:54 CEST 2013


Hello,

A friend from Brazil found a small problem in "resolve" unit.

Before execute the test:

http://imagebin.org/256886

After execute the test:

http://imagebin.org/256887

And the test is:

procedure TForm1.Button1Click(Sender : TObject);
begin
  with TInetSocket.Create('www.google.com', 80) do
  try
  finally
    Free;
  end;
end;

After debug the TInetSocket class, the problem continues in:

procedure TForm1.Button1Click(Sender : TObject);
begin
 with THostResolver.Create(nil) do
  try
    if not NameLookup('www.google.com') then
      raise Exception.Create('não resolvido');
  finally
    Free;
  end;
end;

And finally, you can reproduce it with:

uses
  resolve, winsock;

procedure TForm1.Button1Click(Sender: TObject);
var
  FHostEntry: PHostEnt;
begin
  FHostEntry := gethostbyname('www.google.com.br');
end;

But, if in code above I undeclare the "resolve" unit, I got only one thread
(threads = 1).

Is this a bug?

Thank you!

-- 
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130508/3eb334aa/attachment.html>


More information about the fpc-pascal mailing list