🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: WaitForMultipleObjects in TThread

#11675
From: Oliver Rutsch
Date: Thu, 29 Jan 2004 15:08
18 lines
1799 bytes
Hi Kristoffer,

> I would like to call WaitForSingleObjects infinitely in TThread, to wait for
> a handle to be signalled. How can I know when the thread should be
> terminated (like thread receiving a WM_QUIT message)?
> 

Use WaitForMultipleObjects and define an array of events (a terminate 
event, your origin event ...). When the wait returns, react on the 
WAIT_OBJECT_0 ... WAIT_OBJECT_X return values and let your thread end 
gracefully if it receives the terminate event.

Hope that helps,

-- 
Dipl. Ing. Oliver Rutsch
EMail: Name:orutsch domain:sympatec.com
Sympatec GmbH Germany
Technical Details
Message-ID: <1075389099.199618@post.sympatec.net>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <40191ff7$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,2e632a3799f22e8b
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2004-01-29 07:38:52 PST
Date: Thu, 29 Jan 2004 16:08:57 +0100
From: Oliver Rutsch <nospam@sympatec.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.6) Gecko/20040113
X-Accept-Language: en-us, en, de-de
MIME-Version: 1.0
Newsgroups: borland.public.cppbuilder.nativeapi
Subject: Re: WaitForMultipleObjects in TThread
References: <40191ff7$1@newsgroups.borland.com>
In-Reply-To: <40191ff7$1@newsgroups.borland.com>
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Organization: Ye 'Ol Disorganized NNTPCache groupie
Message-ID: <1075389099.199618@post.sympatec.net>
Cache-Post-Path: post.sympatec.net!unknown@rutsch.tksympatec
X-Cache: nntpcache 3.0.1 (see http://www.nntpcache.org/)
NNTP-Posting-Host: 217.6.163.138
X-Trace: newsgroups.borland.com 1075389099 217.6.163.138 (29 Jan 2004 07:11:39 -0700)
Lines: 18
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!nntp-relay.ihug.net!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail