🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.internet.socket
Article #2010

Re: help with Indy Telnet

#2010
From: Remy Lebeau (TeamB)
Date: Tue, 05 Sep 2006 18:15
25 lines
2561 bytes
"Andre' Burke" <no.spam@spam.no> wrote in message
news:44fd6bbc@newsgroups.borland.com...

> From looking at the IdTelnet.pas file, it would seem that if I were to
call
> the Disconnect method from inside my main thread while the OnDataAvailable
> is busy within the connection's thread, that the main thread would block
> until the connection thread was terminated, since the Disconnect method
> calls Terminate for the thread and then does a waitfor on it.

When the ThreadedEvent property is False, OnDataAvailable is triggered via a
call to TThread::Synchronize().  Synchronize() requires the main thread to
reply to the request, so the main thread can't be fully blocked, or else the
thread will also be blovked.  Fortunately, TThread::WaitFor() does allow
Synchronize() calls to finish their work.  So even if Disconnect() (and thus
TThread::WaitFor()) were called in the context of the main thread,
TIdTelnet's reading thread should still be able to terminate cleanly and
then release WaitFor() from its waiting.  The only time that would not
happen is if your OnDataAvailable event handler is performing operations
that require the main message queue (which is blocked), in which case you
will have to call Application->ProcessMessages() in your code.


Gambit
Technical Details
Message-ID: <44fdc097$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <44f68cef@newsgroups.borland.com> <44f6917c$1@newsgroups.borland.com> <44f69c27@newsgroups.borland.com> <adsdf2dk8k4s0tefv5r49fi67ghjs6rlmt@4ax.com> <44f7d1ac$1@newsgroups.borland.com> <44f7e8a0$1@newsgroups.borland.com> <44f7ef1a@newsgroups.borland.com> <44f86462$1@newsgroups.borland.com> <4veof257rj29kb6armgc2qgsds3q512tqh@4ax.com> <44fc7c6c$1@newsgroups.borland.com> <44fd6bbc@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,3d66693bd859a203
X-Google-Attributes: gid11508e,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.internet.socket
References: <44f68cef@newsgroups.borland.com> <44f6917c$1@newsgroups.borland.com> <44f69c27@newsgroups.borland.com> <adsdf2dk8k4s0tefv5r49fi67ghjs6rlmt@4ax.com> <44f7d1ac$1@newsgroups.borland.com> <44f7e8a0$1@newsgroups.borland.com> <44f7ef1a@newsgroups.borland.com> <44f86462$1@newsgroups.borland.com> <4veof257rj29kb6armgc2qgsds3q512tqh@4ax.com> <44fc7c6c$1@newsgroups.borland.com> <44fd6bbc@newsgroups.borland.com>
Subject: Re: help with Indy Telnet
Date: Tue, 5 Sep 2006 11:15:51 -0700
Lines: 27
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <44fdc097$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1157480599 68.69.17.41 (5 Sep 2006 11:23:19 -0700)
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail