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


Groups > comp.lang.c > #68524

Re: sht static guard locks

From Ian Collins <ian-news@hotmail.com>
Newsgroups comp.lang.c
Subject Re: sht static guard locks
Date 2015-08-28 09:51 +1200
Message-ID <d49f2bFrgntU9@mid.individual.net> (permalink)
References <3c9716ac-61bd-4d69-bdcd-3635ea54bf73@googlegroups.com> <mrnuig$8rv$1@dont-email.me>

Show all headers | View raw


jacobnavia wrote:
> Le 27/08/2015 20:11, fir a écrit :
>> Im not sure if this is a problem of c++
>> only or it appleies to c, too
>>
>> Sometimes (usually?) when using static entities
>> in functions the compiler puts special code which
>> contains a lock acquire and release
>>
>
> This is because C++ changed yet again the language underneath your feet.

That's right, a well publicised change was introduced to make static 
variables thread safe.

>> Thisd bloats the executable yet also slows down the code.. Im not quite sure
>> 1)how serious this problem is?
>
> If you do not care about performance (as many C++ people do) it doesn't
> matter. If you are very interested in performance this is a serious problem.

It depends on whether you want speed or correct behaviour with multiple 
threads.  Static variables and threads are a bad combination.

-- 
Ian Collins

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


Thread

sht static guard locks fir <profesor.fir@gmail.com> - 2015-08-27 11:11 -0700
  Re: sht static guard locks jacobnavia <jacob@jacob.remcomp.fr> - 2015-08-27 23:15 +0200
    Re: sht static guard locks Ian Collins <ian-news@hotmail.com> - 2015-08-28 09:51 +1200
      Re: sht static guard locks Les Cargill <lcargill99@comcast.com> - 2015-08-27 18:06 -0500
        Re: sht static guard locks David Brown <david.brown@hesbynett.no> - 2015-08-28 10:14 +0200
          Re: sht static guard locks Les Cargill <lcargill99@comcast.com> - 2015-08-28 21:30 -0500
            Re: sht static guard locks fir <profesor.fir@gmail.com> - 2015-08-29 00:46 -0700
              Re: sht static guard locks fir <profesor.fir@gmail.com> - 2015-08-29 01:39 -0700
                Re: sht static guard locks fir <profesor.fir@gmail.com> - 2015-08-29 03:09 -0700
                Re: sht static guard locks David Brown <david.brown@hesbynett.no> - 2015-08-29 12:43 +0200
              Re: sht static guard locks fir <profesor.fir@gmail.com> - 2015-08-29 03:20 -0700
              Re: sht static guard locks fir <profesor.fir@gmail.com> - 2015-08-29 04:28 -0700
            Re: sht static guard locks David Brown <david.brown@hesbynett.no> - 2015-08-29 12:38 +0200
    Re: sht static guard locks Ian Collins <ian-news@hotmail.com> - 2015-08-28 11:02 +1200
      Re: sht static guard locks Gareth Owen <gwowen@gmail.com> - 2015-08-31 18:15 +0100

csiph-web