develooper Front page | perl.perl5.changes | Postings from January 2022

[Perl/perl5] 7b2136: For C++ extensions, use the pthreads definitionof...

From:
Nicholas Clark via perl5-changes
Date:
January 7, 2022 20:13
Subject:
[Perl/perl5] 7b2136: For C++ extensions, use the pthreads definitionof...
Message ID:
Perl/perl5/push/refs/heads/smoke-me/nicholas/pthreads-not-_Thread_local-for-C++/ec238e-7b2136@github.com
  Branch: refs/heads/smoke-me/nicholas/pthreads-not-_Thread_local-for-C++
  Home:   https://github.com/Perl/perl5
  Commit: 7b21363d3b21abf1e0e89b026c7bd25a3aaeefdc
      https://github.com/Perl/perl5/commit/7b21363d3b21abf1e0e89b026c7bd25a3aaeefdc
  Author: Nicholas Clark <nick@ccl4.org>
  Date:   2022-01-07 (Fri, 07 Jan 2022)

  Changed paths:
    M thread.h

  Log Message:
  -----------
  For C++ extensions, use the pthreads definition of PERL_GET_CONTEXT

Configure probes the C compiler to find out whether it supports C11 thread
local storage, and if found uses this for PERL_SET_CONTEXT/PERL_GET_CONTEXT,
in preference to the pthread_setspecific()/pthread_getspecific() approach.

However, we can come unstuck with XS extensions written in C++, as C++ and C
disagree on the syntax used for thread local storage, meaning that the
working token that Configure probed for C turns out to be a compiler error
on C++.

As Configure doesn't have a way to probe for C++ dialects, we just take the
safe option and do the same as 5.34.0 and earlier - use pthreads on C++.

This commit is minimal because the implementation of PERL_SET_CONTEXT for
C11 thread local storage was already defensively written to *also* call
pthread_setspecific().





nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About