Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #24387

Re: How to name a function to indicate that they require calling from a critical section?

From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: How to name a function to indicate that they require calling from a critical section?
Date 2012-08-09 13:59 -0700
Organization None to speak of
Message-ID <lnmx23vl2c.fsf@nuthaus.mib.org> (permalink)
References <12497759-f557-4c9a-a4f4-7bcf177b251d@googlegroups.com> <chine.bleu-9D7440.12243309082012@news.eternal-september.org>

Show all headers | View raw


"China Blue [Tor], Meersburg" <chine.bleu@yahoo.com> writes:
> In article <12497759-f557-4c9a-a4f4-7bcf177b251d@googlegroups.com>,
>  celephicus@gmail.com wrote:
>
>> Good programmers know about critical sections, which protect shared
>> resources. Good programmers use descriptive names. I just spent a day
>> tracking down a real-time bug due to me calling a function outside a
>> critical section.
>> 
>> How would you name a function to indicate that it should only be
>> called from within a critical section? Something like
>> doStuff_critical() with the "_critical" telling you the requirement
>> for a critical section. But of course less ugly.
>> 
>> Any ideas?
>
> zephodBeebleBrox_function

How does appending "_function" to the name suggest critical sections? Or
did you mean something else?

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
    Will write code for food.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to name a function to indicate that they require calling from a critical section? celephicus@gmail.com - 2012-08-08 18:55 -0700
  Re: How to name a function to indicate that they require calling from a critical section? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-09 08:31 -0400
  Re: How to name a function to indicate that they require calling from a critical section? "China Blue [Tor], Meersburg" <chine.bleu@yahoo.com> - 2012-08-09 12:24 -0700
    Re: How to name a function to indicate that they require calling from a critical section? Keith Thompson <kst-u@mib.org> - 2012-08-09 13:59 -0700
  Re: How to name a function to indicate that they require calling from a critical section? Andrew Cooper <amc96@cam.ac.uk> - 2012-08-09 21:43 +0100
    Re: How to name a function to indicate that they require calling from a critical section? Keith Thompson <kst-u@mib.org> - 2012-08-09 13:58 -0700
      Re: How to name a function to indicate that they require calling from a critical section? Andrew Cooper <amc96@cam.ac.uk> - 2012-08-09 23:11 +0100
        Re: How to name a function to indicate that they require calling from a critical section? Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-09 18:22 -0400
      Re: How to name a function to indicate that they require calling from a critical section? Tim Rentsch <txr@alumni.caltech.edu> - 2012-09-07 08:37 -0700
        Re: How to name a function to indicate that they require calling from a critical section? Stephen Sprunk <stephen@sprunk.org> - 2012-09-07 16:01 -0500
          Re: How to name a function to indicate that they require calling from a critical section? Tim Rentsch <txr@alumni.caltech.edu> - 2012-09-07 18:37 -0700
            Re: How to name a function to indicate that they require calling from a critical section? Stephen Sprunk <stephen@sprunk.org> - 2012-09-30 00:17 -0500
              Re: How to name a function to indicate that they require calling from a critical section? Tim Rentsch <txr@alumni.caltech.edu> - 2012-12-17 14:24 -0800
          Re: How to name a function to indicate that they require calling   from a critical section? Ian Collins <ian-news@hotmail.com> - 2012-09-08 13:56 +1200
            Re: How to name a function to indicate that they require calling   from a critical section? Stephen Sprunk <stephen@sprunk.org> - 2012-09-30 13:45 -0500

csiph-web