Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!cornell!uw-beaver!ssc-vax!cxsea!blm From: blm@cxsea.UUCP (Brian Matthews) Newsgroups: comp.std.c Subject: Re: volatile registers Message-ID: <2592@cxsea.UUCP> Date: 6 Jan 89 17:14:38 GMT References: <141@bms-at.UUCP> <275@twwells.uucp> <15166@mimsy.UUCP> <9236@smoke.BRL.MIL> <15171@mimsy.UUCP> <9316@ihlpb.ATT.COM> <2337@cuux <10720@rpp386.Dallas.TX.US> Reply-To: blm@cxsea.UUCP (Brian Matthews) Organization: Computer X Inc. Lines: 32 The Beach Bum (jfh@rpp386.Dallas.TX.US) writes: |A common usage is in interrupt [ software ] handlers where the |signal catching routine sets a flag and returns. | |The proper definition for such a flag should be | |in catch.c: |-- |int sigflag; | |int catch (sig) |{ | ... | sigflag = 1; | ... |} |-- |then outside catch.c you must use | |extern volatile int sigflag; The spirit of the posting is correct, but there are a couple of technical errors. First, the type of sigflag should be sig_atomic_t, not int. Second, as the function argument to signal is void (*fn)(int), catch should be a void function. See the signal handling section of the draft (section 4.7, I believe). -- Brian L. Matthews blm@cxsea.UUCP ...{mnetor,uw-beaver!ssc-vax}!cxsea!blm +1 206 251 6811 Computer X Inc. - a division of Motorola New Enterprises