Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
b05cf382
Commit
b05cf382
authored
Apr 18, 2016
by
Jonathan Wakely
Committed by
Jonathan Wakely
Apr 18, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define std::thread::id comparison operators at namespace-scope
From-SVN: r235155
parent
4ed6e524
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
49 additions
and
14 deletions
+49
-14
libstdc++-v3/ChangeLog
+5
-0
libstdc++-v3/include/std/thread
+20
-14
libstdc++-v3/testsuite/30_threads/thread/id/70294.cc
+24
-0
No files found.
libstdc++-v3/ChangeLog
View file @
b05cf382
2016-04-18 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/70294
* include/std/thread (operator<, operator==): Move definitions to
namespace-scope.
* testsuite/30_threads/thread/id/70294.cc: New test.
* testsuite/18_support/bad_exception/23591_thread-1.c: Add
-Wno-pedantic to dg-options.
* testsuite/20_util/align/2.cc: Use type as operand of alignof.
...
...
libstdc++-v3/include/std/thread
View file @
b05cf382
...
...
@@ -88,22 +88,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
friend class hash<thread::id>;
friend bool
operator==(thread::id __x, thread::id __y) noexcept
{
// pthread_equal is undefined if either thread ID is not valid, so we
// can't safely use __gthread_equal on default-constructed values (nor
// the non-zero value returned by this_thread::get_id() for
// single-threaded programs using GNU libc). Assume EqualityComparable.
return __x._M_thread == __y._M_thread;
}
operator==(thread::id __x, thread::id __y) noexcept;
friend bool
operator<(thread::id __x, thread::id __y) noexcept
{
// Pthreads doesn't define any way to do this, so we just have to
// assume native_handle_type is LessThanComparable.
return __x._M_thread < __y._M_thread;
}
operator<(thread::id __x, thread::id __y) noexcept;
template<class _CharT, class _Traits>
friend basic_ostream<_CharT, _Traits>&
...
...
@@ -231,10 +219,28 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
{ __x.swap(__y); }
inline bool
operator==(thread::id __x, thread::id __y) noexcept
{
// pthread_equal is undefined if either thread ID is not valid, so we
// can't safely use __gthread_equal on default-constructed values (nor
// the non-zero value returned by this_thread::get_id() for
// single-threaded programs using GNU libc). Assume EqualityComparable.
return __x._M_thread == __y._M_thread;
}
inline bool
operator!=(thread::id __x, thread::id __y) noexcept
{ return !(__x == __y); }
inline bool
operator<(thread::id __x, thread::id __y) noexcept
{
// Pthreads doesn't define any way to do this, so we just have to
// assume native_handle_type is LessThanComparable.
return __x._M_thread < __y._M_thread;
}
inline bool
operator<=(thread::id __x, thread::id __y) noexcept
{ return !(__y < __x); }
...
...
libstdc++-v3/testsuite/30_threads/thread/id/70294.cc
0 → 100644
View file @
b05cf382
// Copyright (C) 2016 Free Software Foundation, Inc.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3, or (at your option)
// any later version.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License along
// with this library; see the file COPYING3. If not see
// <http://www.gnu.org/licenses/>.
// { dg-options "-std=gnu++11" }
// { dg-do compile }
#include <thread>
bool
(
*
lt
)(
std
::
thread
::
id
,
std
::
thread
::
id
)
=
&
std
::
operator
<
;
bool
(
*
eq
)(
std
::
thread
::
id
,
std
::
thread
::
id
)
=
&
std
::
operator
==
;
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment