🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: WaitForSingleObject()

#15215
From: Paul Ooi
Date: Sat, 12 Jul 2003 03:24
31 lines
1938 bytes
I tried with default, it doesn't work.
Is it because I close the handle AFTER the wait function is called?

Paul


"Bob Gonder" <notbg@notmindspring.invalid> wrote in message
news:mrtugv80rjdoc7ub6nca8i6e55jeaar0c8@4ax.com...
> "Paul Ooi"  wrote:
>
> >for (;;)
> >{    switch(WaitForSingleObject(HNDEvent, INFINITE)
> >    {
> >        case WAIT_OBJECT_0:
> >            ......
> >            break;
> >        case WAIT_FAILED:
> >            return 0;
> >    }
> >}
>
> >and I expect WaitForSingleObject() in the infinite loop to return with
> >WAIT_FAILED and terminates the thread.  Is that OK?
>
> I'd expect  WAIT_FAILED  if the event handle was invalid; (no wait).
> Possable you might get WAIT_ABANDONED too.
> I'd try it with replacing case WAIT_FAILED: with default:
> That is, ANY return other than what we expect (WAIT_OBJECT_0) will
> quit.
>
>
Technical Details
Message-ID: <3f0f7f61@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail
References: <3f0f500e$2@newsgroups.borland.com> <mrtugv80rjdoc7ub6nca8i6e55jeaar0c8@4ax.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10cc67,17beab47e7f815ec
X-Google-Attributes: gid10cc67,public
X-Google-ArrivalTime: 2003-07-11 20:40:27 PST
From: "Paul Ooi" <yitung.ooi@student.unsw.edu.au>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <3f0f500e$2@newsgroups.borland.com> <mrtugv80rjdoc7ub6nca8i6e55jeaar0c8@4ax.com>
Subject: Re: WaitForSingleObject()
Date: Sat, 12 Jul 2003 11:24:32 +0800
Lines: 33
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: 129.94.198.109
Message-ID: <3f0f7f61@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1057980257 129.94.198.109 (11 Jul 2003 20:24:17 -0700)
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail