🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #8739

Re: Thread WaitFor() ....waits forever

#8739
From: Daniel Stevenson
Date: Wed, 22 Sep 2004 06:51
25 lines
1779 bytes
>
> You are mis-using the thread pointer.  See below.
>
> >     delete MyForm1;
> >     MyForm1 = NULL;
>
> You should never call 'delete' on a thread that has its FreeOnTerminate
> property set to true.

I don't actually use delete when terminating my thread.  The above delete is
deleting my form after the thread is supposed to be terminated.

>
> That is because you are deadlocking the code.  WaitForSingleObject() is
> waiting for the thread to terminate, but the thread is waiting for the
main
> thread to process the Synchronize() requests so that it can then continue
on
> and eventually detect that it needs to terminate itself.
>

I sort of understand what you are implying but I'm not sure how to stop my
thread from being deadlocked.  As far as I know, the Synchronize function is
fairly straight forward and should be able to be completed.
Technical Details
Message-ID: <415120dc@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <415108cd$1@newsgroups.borland.com> <4151128c$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,1897390e79ed181f
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Daniel Stevenson" <d.stevenson@ocreage.com.au>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <415108cd$1@newsgroups.borland.com> <4151128c$1@newsgroups.borland.com>
Subject: Re: Thread WaitFor() ....waits forever
Date: Wed, 22 Sep 2004 16:51:06 +1000
Lines: 28
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1158
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1165
NNTP-Posting-Host: 202.174.228.150
Message-ID: <415120dc@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1095835868 202.174.228.150 (21 Sep 2004 23:51:08 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail