🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.databases
Article #75

Re: Background thread writing to DB - dealing with app shutdown

#75
From: John smith
Date: Tue, 12 Jan 1999 00:00
37 lines
2074 bytes
Strange, it works for me. Maybe the thread object references something in
main form (or other) or it creates a component with application as owner. If
this is the case, then your main form should wait for other threads to
complete before closing.
ad1: No. Application shut down=main thread shuts down, but OS does not
unload process until all threads complete (at least I think so).
ad2: Yes, that's correct.

--
----------------------
Regards
Robert Cerny
Remove both qwe when replying
email: robert.qwe.cerny@neosys.xrs.qwe.si

No questions via email, unless explicitly invited.
Chris Moseley wrote in message <369BBB1F.A581D919@acs.co.nz>...
>
>Hi all.
>
>I have a background thread writing a (selective) log of user
>activity to a table for audit purposes. On occasion this will
>receive a significant number of entries just before the app
>terminates (the user goes "yup, save all of those, I'm done").
>
>At this stage the UserLog unit creates/starts and frees the
>thread in the initialization/finalization sections, but
>this causes AV's if the thread is active when the app
>terminates - it looks as if the memory used is free'd from
>underneath the thread.
>
>Questions:
>1: does code in the finalization block actually have to
>   complete before the app shuts down? I've assumed so.
>2: It looks as if the app does not wait for my thread to
>   terminate. Correct?
>
Technical Details
Message-ID: <P5Qm2.303$2u.5482710@news.siol.net>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <369BBB1F.A581D919@acs.co.nz>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: ffff5,20a07d8886a0460,start
X-Google-Attributes: gidffff5,public
X-Google-Thread: ff75c,20a07d8886a0460,start
X-Google-Attributes: gidff75c,public
From: "John smith" <johnsmith@microsoft.com>
Subject: Re: Background thread writing to DB - dealing with app shutdown
Date: 1999/01/12
Message-ID: <P5Qm2.303$2u.5482710@news.siol.net>
X-Deja-AN: 431905715
References: <369BBB1F.A581D919@acs.co.nz>
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
NNTP-Posting-Date: Tue, 12 Jan 1999 23:34:23 MET DST
Newsgroups: comp.lang.pascal.delphi.databases,borland.public.delphi.database.desktop