🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Closing application and Threads

#10746
From: Jani
Date: Tue, 23 Mar 2004 18:39
39 lines
1961 bytes
Hi!

Here I am again, asking for some advice ;)
Faily new to threads I have hard time understanding some things.

I'm working on a project that needs several worker threads doing queries 
of all sorts, some take less time, some more (upto say, 30 seconds).
I store all my created Threads in a TList so I can access them from the 
main VCL thread.

Problem I'm facing (or not?) is when a user closes the program before all 
the worker threads are terminated.
The worker threads use Synchronize() to update the main VCL with data they 
have gathered.
Ok, the problem is, as I stated above when users closes the program, and 
the threads are still there, trying to
report back to the allready freed main VCL using Synchronize().
Wont that cause problems?
Code guard goes nuts saying something like "trying to access already freed 
memory".
Btw, the threads are freed on terminate using FreeOnTerminate=true;

Maybe I'm missing something trivial here?

Suggestions? Good links with more about threads? Please do reply :)

Regards
/Jani
Technical Details
Message-ID: <opr5bvfx0rcdadgw@localhost>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,16bcdba8970e0b14,start
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-03-23 10:40:36 PST
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Closing application and Threads
From: Jani <jani@jvpp.com>
Organization: n/a
Content-Type: text/plain; format=flowed; charset=iso-8859-15
MIME-Version: 1.0
Content-Transfer-Encoding: Quoted-Printable
Date: Tue, 23 Mar 2004 19:39:23 +0100
Message-ID: <opr5bvfx0rcdadgw@localhost>
User-Agent: Opera7.23/Win32 M2 build 3227
NNTP-Posting-Host: 213.113.49.201
X-Trace: newsgroups.borland.com 1080067071 213.113.49.201 (23 Mar 2004 10:37:51 -0800)
Lines: 39
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail