git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.keller@gmail.com>
To: Philip Oakley <philipoakley@iee.org>
Cc: Johannes Sixt <j6t@kdbg.org>, Stefan Beller <sbeller@google.com>,
	Junio C Hamano <gitster@pobox.com>,
	Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Git mailing list <git@vger.kernel.org>,
	Simon Ruderich <simon@ruderich.org>, Jeff King <peff@peff.net>
Subject: Re: [PATCH] compat: Allow static initializer for pthreads on Windows
Date: Fri, 28 Oct 2016 11:49:25 -0700	[thread overview]
Message-ID: <CA+P7+xoNSrhaQ50GZ4RzLregznw+0yf2=ttNuYf1VUw+YabdFQ@mail.gmail.com> (raw)
In-Reply-To: <B5FD05E58E36480894F1BDBBC9589EE1@PhilipOakley>

On Fri, Oct 28, 2016 at 6:01 AM, Philip Oakley <philipoakley@iee.org> wrote:
> From: "Johannes Sixt" <j6t@kdbg.org>
>>
>>
>> One point is that the DCLP idiom must be implemented correctly. There are
>> solutions, of course, and when the initialization is over, we have a
>> miniscule overhead at each pthread_mutex_lock call.
>>
>
> I had to look up DCLP ( = Double Checked Locking Patterns), and found a good
> write up on the issues..
>
> http://www.aristeia.com/Papers/DDJ_Jul_Aug_2004_revised.pdf "C++ and the
> Perils of Double-Checked Locking", which include 'C' issues, and
> multi-thread, multi-processor issues. Not an easy issue when fighting
> optimisers..
>
> --
>
> Philip


Yep, this is why we have memory barriers. Ofcourse languages like C
don't really allow you to express them in the language and we restore
to various platform specific methods.

Thanks,
Jake

  reply	other threads:[~2016-10-28 18:49 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-26 21:57 [PATCH] compat: Allow static initializer for pthreads on Windows Stefan Beller
2016-10-26 22:14 ` Stefan Beller
2016-10-27  5:49 ` Johannes Sixt
2016-10-27  6:02   ` Junio C Hamano
2016-10-27  6:10     ` Johannes Sixt
2016-10-27  6:21       ` Junio C Hamano
2016-10-27  6:29         ` Johannes Sixt
2016-10-27  6:33         ` Junio C Hamano
2016-10-27 17:01           ` Stefan Beller
2016-10-27 17:11             ` Jeff King
2016-10-27 18:22             ` Johannes Sixt
2016-10-27 18:49               ` Junio C Hamano
2016-10-27 19:08                 ` Stefan Beller
2016-10-27 20:05                   ` Johannes Sixt
2016-10-27 21:49                     ` Jacob Keller
2016-10-27 21:59                       ` Stefan Beller
2016-10-28  5:55                       ` Johannes Sixt
2016-10-28  6:11                         ` Jacob Keller
2016-10-28 13:01                         ` Philip Oakley
2016-10-28 18:49                           ` Jacob Keller [this message]
2016-10-28 11:58                       ` Johannes Schindelin
2016-10-28 18:48                         ` Jacob Keller
2016-10-28 20:26                           ` Johannes Sixt
2016-10-28 20:29                             ` Junio C Hamano
2016-10-28 20:36                               ` Stefan Beller
2016-10-28 20:38                                 ` Junio C Hamano
2016-10-28 20:49                               ` Johannes Sixt
2016-10-28 20:52                                 ` Junio C Hamano

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='CA+P7+xoNSrhaQ50GZ4RzLregznw+0yf2=ttNuYf1VUw+YabdFQ@mail.gmail.com' \
    --to=jacob.keller@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=peff@peff.net \
    --cc=philipoakley@iee.org \
    --cc=sbeller@google.com \
    --cc=simon@ruderich.org \
    /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 NNTP newsgroup(s).