public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@redhat.com>
To: Rich Felker <dalias@libc.org>, Torvald Riegel <triegel@redhat.com>
Cc: Szabolcs Nagy <szabolcs.nagy@arm.com>,
	GNU C Library <libc-alpha@sourceware.org>,
	Jonathan Wakely <jwakely@redhat.com>
Subject: Re: [PATCH] pthread_once hangs when init routine throws an exception [BZ #18435]
Date: Wed, 03 Jun 2015 20:24:00 -0000	[thread overview]
Message-ID: <556F6012.6090502@redhat.com> (raw)
In-Reply-To: <20150603191444.GM17573@brightrain.aerifal.cx>

On 06/03/2015 01:14 PM, Rich Felker wrote:
> On Wed, Jun 03, 2015 at 01:03:47PM +0200, Torvald Riegel wrote:
>> On Mon, 2015-06-01 at 12:41 -0600, Martin Sebor wrote:
>>> Beyond call_once, C++ 11 encourages implementations to
>>> provide a member function called native_handle() that
>>> returns a reference to the underlying native object.
>>> libstdc++ mutex (and other classes) expose this member
>>> function to provide interoperability with pthreads. As
>>> a result, reimplementing libstdc++ independently of libc
>>> is impossible without losing such interoperability and
>>> without breaking compatibility with existing code.
>>
>> Note that the interoperability is also a dependency.  I think it's
>> actually better for libstdc++ to not make an ABI guarantee that
>> native_handle() returns a pointer to a PThreads entity;  this way, we do
>> have the freedom to improve libstdc++ independently of glibc and more
>> importantly of POSIX.
>> I don't know for sure whether Jonathan has applied the change already,
>> but IIRC, we agreed that native_handle() should return void*.
>
> I'm strongly in favor of having the underlying implementations be
> opaque and not guaranteeing pthread.

As the risk of continuing to diverge from the main topic of
this thread I think it might be worth clarifying this point.

The sole purpose of the native_handle() function (whatever
its return type may be) is to make it possible for components
such as libraries to operate on the same mutex or thread object
using the pthreads (or other "native") API as C++ programs that
create and manipulate the objects using the C++ APIs and use
the libraries. (I.e., the purpose is not just to expose some
sort of a unique id for the object).

Since libstdc++ is already implemented in terms of pthreads
and exposes the underlying pthreads types via native_handle
(with all the ABI/API ramifications), I suspect there's
little chance that the underlying implementation can change.

Clang's libc++ does the same thing, as does the Visual C++
standard library (which exposes the OS HANDLE (void*) as its
native_handle_type).

Martin

  reply	other threads:[~2015-06-03 20:14 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <556B7F10.40209@redhat.com>
2015-06-01  8:39 ` Florian Weimer
2015-06-01 16:27   ` Martin Sebor
2015-06-02  9:53     ` Mike Frysinger
2015-06-04 21:12       ` Martin Sebor
2015-06-03 11:36     ` Torvald Riegel
2015-06-01 10:20 ` Szabolcs Nagy
2015-06-01 19:47   ` Martin Sebor
2015-06-03 11:07     ` Torvald Riegel
2015-06-03 11:11       ` Jonathan Wakely
2015-06-03 20:14       ` Rich Felker
2015-06-03 20:24         ` Martin Sebor [this message]
2015-06-03 23:49           ` Rich Felker
2015-06-04  1:47             ` Martin Sebor
2015-06-04  5:38               ` Rich Felker
2015-06-04  7:29                 ` Martin Sebor
2015-06-08 11:41                 ` Jonathan Wakely
2015-06-08 14:38                   ` Szabolcs Nagy
2015-06-04  8:20           ` Torvald Riegel
2015-06-08 11:48             ` Jonathan Wakely
2015-06-08 16:01               ` Florian Weimer
2015-06-03 11:07   ` Torvald Riegel
2015-06-01 14:39 ` Andreas Schwab
2015-06-09 19:49 ` Martin Sebor
2015-06-15 22:14   ` Martin Sebor
2015-06-23  7:48     ` [PING 2] " Martin Sebor
     [not found]       ` <5593256B.5060402@redhat.com>
2015-07-01  0:06         ` [PING 3] " Rich Felker
2015-07-01 20:18           ` Martin Sebor
2015-07-01 21:27             ` Joseph Myers
2015-07-06 13:18   ` Szabolcs Nagy
2015-07-06 14:16     ` Martin Sebor
2015-07-06 14:58       ` Adhemerval Zanella
2015-07-06 16:33         ` Szabolcs Nagy
2015-07-06 17:09           ` Szabolcs Nagy
2015-07-08 11:00             ` Szabolcs Nagy
2015-07-08 16:09               ` Carlos O'Donell
2015-07-08 16:33                 ` Torvald Riegel
2015-07-08 16:52                   ` Szabolcs Nagy
2015-07-08 17:14                     ` Carlos O'Donell
2021-03-02 16:43                 ` Jakub Jelinek
2015-07-08 16:16 ` Carlos O'Donell
2015-07-08 21:28   ` Martin Sebor
2015-07-08 22:13     ` Szabolcs Nagy
2015-07-08 22:52       ` Martin Sebor
2015-07-08 23:42         ` Szabolcs Nagy
2015-07-09  4:46         ` Martin Sebor
2015-07-09 23:41           ` Martin Sebor
2021-03-03 12:52 Jakub Jelinek
2021-03-04 11:50 ` Florian Weimer
2021-03-04 13:00   ` Jakub Jelinek
2021-03-04 13:26     ` Florian Weimer
2021-03-04 14:14       ` Jakub Jelinek

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=556F6012.6090502@redhat.com \
    --to=msebor@redhat.com \
    --cc=dalias@libc.org \
    --cc=jwakely@redhat.com \
    --cc=libc-alpha@sourceware.org \
    --cc=szabolcs.nagy@arm.com \
    --cc=triegel@redhat.com \
    /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).