🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: aborting a function

#14908
From: JD
Date: Sat, 26 Jul 2003 12:50
28 lines
1687 bytes
"Robert L. Smith" <bsmithOMIT@cinSPAMele.com> wrote:
> [...] Because it uses the serial port, this function is not
> re-entrant.

Why not? You don't need a thread or a timer or a call stack -
just an an abort flag and two static variables:

void __fastcall TForm1::ButtonClick(TObject *Sender)
{
    static int ExtraClickCounter = 0;
    static bool AlreadyTalking = false;

    if( !AlreadyTalking )
      {
      AlreadyTalking = true;
      // check for abort and get your serial data
      AlreadyTalking = false;
      if( ExtraClickCounter > 0 )
        {
        ExtraClickCounter--;
        ButtonClick( Sender );
        }
      }
    else ExtraClickCounter++;
}
  
~ JD
Technical Details
Message-ID: <3f2278ff$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!38.144.126.70.MISMATCH!feed3.newsreader.com!newsreader.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <3f21a974@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 05:52:53 PST
From: "JD" <nospam@nospam.com>
Sender: "JD" <nospam@nospam.com>
Reply-To: "JD" <nospam@nospam.com>
Subject: Re: aborting a function
Newsgroups: borland.public.cppbuilder.nativeapi
X-User-Info: 172.201.87.189 172.201.87.189    
References:  <3f21a974@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.65
Message-ID: <3f2278ff$1@newsgroups.borland.com>
Date: 26 Jul 2003 05:50:07 -0700
X-Trace: newsgroups.borland.com 1059223807 207.105.83.65 (26 Jul 2003 05:50:07 -0700)
Lines: 29
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!sn-xit-09!supernews.com!newshosting.com!news-xfer1.atl.newshosting.com!38.144.126.70.MISMATCH!feed3.newsreader.com!newsreader.com!border1.nntp.aus1.giganews.com!nntp.giganews.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail