Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 May : Re: Indy SSL error
| Subject: | Re: Indy SSL error |
| Posted by: | "Koger" (ing..@mail.dk) |
| Date: | 15 May 2006 00:16:58 |
> > Huh? The threads destructor terminates the thread
>
> Not in a safe manner, it doesn't. Letting TThread's destructor
> terminate and wait on the thread instance has all sorts of problems.
> Go to http://www.deja.com to read about them in the newsgroup
> archives. You should always terminate your threads yourself before
> freeing them. Besides, if you look at the code I gave you, you need
> control over the thread's termination anyway so that you can
> disconnect the socket to make Connect() abort immediately.
AFAIK these problems are releated to deadlocking, which isn't the
problem here.
> > > In order to make the Connect() exit as soon as possible, you have
> > > to disconnect the socket from another thread (the main thread in
> > > your example) so that Connect() aborts in the worker thread.
> >
> > But I think that's what I do.
>
> No, you are not doing that at all.
Please look at my code again.
*Main thread*
I create and the SSL socket
starts the thread
sleeps 500ms
*Thread 2*
Starts connecting using the socket
*Main thread*
call socket.disconnect
then WAIT for the thread to terminate (by inheriting the destructor)
I pretty much think this is what you tell me to do, if not would you be
so kind to tell me where I do something wrong?