Move std::unique_lock definition to a separate header
commit53046f072c6e92aa4ba4594c992fe31d89e223ed
authorredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Jul 2018 10:40:12 +0000 (25 10:40 +0000)
committerredi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Wed, 25 Jul 2018 10:40:12 +0000 (25 10:40 +0000)
tree533771db472d612b364ad1252a9002ff46e0abdc
parentb3000498acc756b29e019c90a15415c93a4324cf
Move std::unique_lock definition to a separate header

This will allow std::mutex and std::lock_guard to be used elsewhere in
the library without pulling in the whole of <chrono>.

Previously the whole of <bits/std_mutex.h> was conditional on the
_GLIBCXX_USE_C99_STDINT_TR1 macro, but only the std::unique_lock members
that use <chrono> facilities should depend on that. std::mutex only
needs to depend on _GLIBCXX_HAS_GTHREADS and std::lock_guard can be
defined unconditionally.

Some parts of <bits/std_mutex.h> and <mutex> are based on code in
<ext/concurrence.h> which dates from 2003. However, the std::unique_lock
implementation was added in 2008 by r135007, without using any earlier
code. Therefore the new header file has copyright years 2008-2018.

* include/Makefile.am: Add new <bits/unique_lock.h> header.
* include/Makefile.in: Regenerate.
* include/bits/std_mutex.h [!_GLIBCXX_USE_C99_STDINT_TR1] (mutex)
(lock_guard): Define independent of _GLIBCXX_USE_C99_STDINT_TR1.
(unique_lock): Move definition to ...
* include/bits/unique_lock.h: New header.
[!_GLIBCXX_USE_C99_STDINT_TR1] (unique_lock): Define unconditionally.
[_GLIBCXX_USE_C99_STDINT_TR1] (unique_lock(mutex_type&, time_point))
(unique_lock(mutex_type&, duration), unique_lock::try_lock_until)
(unique_lock::try_lock_for): Define only when <chrono> is usable.
* include/std/condition_variable: Include <bits/unique_lock.h>.
* include/std/mutex: Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@262963 138bc75d-0d04-0410-961f-82ee72b054a4
libstdc++-v3/ChangeLog
libstdc++-v3/include/Makefile.am
libstdc++-v3/include/Makefile.in
libstdc++-v3/include/bits/std_mutex.h
libstdc++-v3/include/bits/unique_lock.h [copied from libstdc++-v3/include/bits/std_mutex.h with 63% similarity]
libstdc++-v3/include/std/condition_variable
libstdc++-v3/include/std/mutex