From: Ross Johnson <Ross.Johnson@homemail.com.au>
To: Ramiro Polla <ramiro@lisha.ufsc.br>,
Pthreads-Win32 list <pthreads-win32@sourceware.org>
Subject: Re: Static libraries initialization
Date: Sat, 26 Apr 2008 00:07:00 -0000 [thread overview]
Message-ID: <48127206.9060205@homemail.com.au> (raw)
In-Reply-To: <4811657E.40608@homemail.com.au>
Ross Johnson wrote:
>>
>> The overhead of one if()? If the branch prediction sets the if() to
>> be unlikely, there should be 1 memory access and 1 cmp function
>> overhead. It shouldn't even disturb the instruction pipeline.
> Yes, it's almost negligible and I use the same method to initialise
> static POSIX mutexes, cond vars, etc., although this one is slightly
> worse in that the data isn't necessarily in cache already or local.
> IIRC, we need to use an Interlocked routine to compare the value, not
> for atomicity necessarily but so that we get the memory barrier
> effects right. And I've found that these calls can be relatively slow
> due to bus locking. I'm also still assuming that every single routine
> needs this overhead, but that may not be necessary in the end.
I'll retract my interlocked/memory fence comments - they aren't needed
here. I keep forgetting it's just the first quick check, and the second
thorough check will only ever be performed once or twice.
Ross
next prev parent reply other threads:[~2008-04-26 0:07 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-04-24 12:53 Ramiro Polla
[not found] ` <4810ABB9.10106@homemail.com.au>
[not found] ` <4810D5C3.2070306@lisha.ufsc.br>
2008-04-25 5:01 ` Ross Johnson
2008-04-26 0:07 ` Ross Johnson [this message]
2008-05-19 11:29 ` Roland Schwarz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48127206.9060205@homemail.com.au \
--to=ross.johnson@homemail.com.au \
--cc=pthreads-win32@sourceware.org \
--cc=ramiro@lisha.ufsc.br \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).