Article View: borland.public.cppbuilder.nativeapi
Article #14913Re: aborting a function
From: Clayton Arends
Date: Sat, 26 Jul 2003 16:26
Date: Sat, 26 Jul 2003 16:26
22 lines
1675 bytes
1675 bytes
"Clayton Arends" <nospam_claytonarends@hotmail.com> wrote in message
news:3f2232db$1@newsgroups.borland.com...
While going to bed last night I thought about a problem in my dummy
routines. I forgot to reset the aborting flag in talk_to_hardware().
int talk_to_hardware()
{
// dummy routine to allow compile
for (int count = 0; count < 20 && !aborting; ++count)
Sleep(100); // sleep short increments to allow for abort
aborting = false; // << reset the flag so subsequent calls work
Beep();
return 0;
}
Additionally you might want to protect 'aborting' with a critical section
since it might be modified by two different threads at the same time.
- Clayton
Technical Details
Message-ID:
<3f22abaf$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mailReferences:
<3f21a974@newsgroups.borland.com> <3f2232db$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 10cc67,cb957e45a585bf2c X-Google-Attributes: gid10cc67,public X-Google-ArrivalTime: 2003-07-26 09:36:23 PST From: "Clayton Arends" <nospam_claytonarends@hotmail.com> Newsgroups: borland.public.cppbuilder.nativeapi References: <3f21a974@newsgroups.borland.com> <3f2232db$1@newsgroups.borland.com> Subject: Re: aborting a function Date: Sat, 26 Jul 2003 09:26:36 -0700 Lines: 24 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: 24.30.128.202 Message-ID: <3f22abaf$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1059236783 24.30.128.202 (26 Jul 2003 09:26:23 -0700) Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-04!sn-xit-01!sn-xit-08!supernews.com!newsfeed.wirehub.nl!news.kweb.on.ca!KWeb!newsgroups.borland.com!not-for-mail