summaryrefslogtreecommitdiffstats
path: root/libcxx/include/mutex
Commit message (Collapse)AuthorAgeFilesLines
* [libc++] Mark __call_once_proxy as hidden and internalLouis Dionne2019-11-111-1/+1
| | | | | | | | | We effectively never want to export that function, which is an implementation detail of libc++. This was previously tried in 603715c66b6b and then reverted in 8335dd314f36 because it caused linker warnings. These linker warnings should go away now that we use internal_linkage instead of always_inline to implement per-TU insulation.
* [libc++] Take 2: Implement LWG 2510Louis Dionne2019-09-261-3/+3
| | | | | | | | | | | | | | | | | | | | | | | Summary: LWG2510 makes tag types like allocator_arg_t explicitly default constructible instead of implicitly default constructible. It also makes the constructors for std::pair and std::tuple conditionally explicit based on the explicit-ness of the default constructibility for the pair/tuple's elements. This was previously committed as r372777 and reverted in r372832 due to the commit breaking LLVM's build in C++14 mode. This issue has now been addressed. Reviewers: mclow.lists Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65161 llvm-svn: 372983
* Revert r372777: [libc++] Implement LWG 2510 and its follow-upsIlya Biryukov2019-09-251-3/+3
| | | | | | | | | | | | This also reverts: - r372778: [libc++] Implement LWG 3158 - r372782: [libc++] Try fixing tests that fail on GCC 5 and older - r372787: Purge mentions of GCC 4 from the test suite Reason: the change breaks compilation of LLVM with libc++, for details see http://lists.llvm.org/pipermail/libcxx-dev/2019-September/000599.html llvm-svn: 372832
* [libc++] Implement LWG 2510Louis Dionne2019-09-241-3/+3
| | | | | | | | | | | | | | | | | | | Summary: LWG2510 makes tag types like allocator_arg_t explicitly default constructible instead of implicitly default constructible. It also makes the constructors for std::pair and std::tuple conditionally explicit based on the explicit-ness of the default constructibility for the pair/tuple's elements. Reviewers: mclow.lists, EricWF Subscribers: christof, jkorous, dexonsmith, libcxx-commits Tags: #libc Differential Revision: https://reviews.llvm.org/D65161 llvm-svn: 372777
* Rework recursive_timed_mutex so that it uses __thread_id instead of using ↵Marshall Clow2019-08-141-3/+3
| | | | | | the lower-level __libcpp_thread_id. This is prep for fixing PR42918. Reviewed as https://reviews.llvm.org/D65895 llvm-svn: 368867
* Revert "Suppress -Wctad-maybe-unsupported on types w/o deduction guides."Eric Fiselier2019-08-041-1/+0
| | | | | | | | | Some modules builds are issuing buggy diagnostics. The cause of which is TBD. This reverts commit r@367770. llvm-svn: 367777
* Suppress -Wctad-maybe-unsupported on types w/o deduction guides.Eric Fiselier2019-08-031-0/+1
| | | | | | | | | | | There are a handful of standard library types that are intended to support CTAD but don't need any explicit deduction guides to do so. This patch adds a dummy deduction guide to those types to suppress -Wctad-maybe-unsupported (which gets emitted in user code). llvm-svn: 367770
* libc++/win: Make once_flag have the same size as a pointer.Nico Weber2019-03-201-5/+14
| | | | | | | | | | | | | | | | | | | | | | `unsigned long` is 32-bit on 32-bit systems and 64-bit on 64-bit systems on LP64 systems -- which most Unix systems are, but Windows isn't. Windows is LLP64, which means unsigned long is 32-bit even on 64-bit systems. pplwin.h contains static_assert(alignof(void *) == alignof(::std::once_flag), ...) which fails due to this problem. Instead of unsigned long, use uintptr_t, which consistently is 32-bit on 32-bit systems and 64-bit on 64-bit systems. No functional change except on 64-bit Windows. Differential Revision: https://reviews.llvm.org/D59607 llvm-svn: 356624
* Update more file headers across all of the LLVM projects in the monorepoChandler Carruth2019-01-191-4/+3
| | | | | | | | | | | | | | | | | | to reflect the new license. These used slightly different spellings that defeated my regular expressions. We understand that people may be surprised that we're moving the header entirely to discuss the new license. We checked this carefully with the Foundation's lawyer and we believe this is the correct approach. Essentially, all code in the project is now made available by the LLVM project under our new license, so you will see that the license headers include that license only. Some of our contributors have contributed code under our old license, and accordingly, we have retained a copy of our old license notice in the top-level files in each project and repository. llvm-svn: 351648
* Annotate scoped_lock as with scoped_lockable attributeAaron Puchert2018-10-091-1/+1
| | | | | | | | | | | | | | | | | | Summary: Scoped capabilities need to be annotated as such, otherwise the thread safety analysis won't work as intended. Fixes PR39234. Reviewers: ldionne Reviewed By: ldionne Subscribers: christof, libcxx-commits Differential Revision: https://reviews.llvm.org/D53049 llvm-svn: 344096
* Implement the infrastructure for feature-test macros. Very few actual ↵Marshall Clow2018-09-121-0/+1
| | | | | | feature test macros, though. Reviewed as: https://reviews.llvm.org/D51955 llvm-svn: 342073
* Implement most of P0607: Inline Variables for the Standard Library. This ↵Marshall Clow2018-01-021-3/+3
| | | | | | involved marking a lot of variables as inline (but only for C++17 and later). llvm-svn: 321658
* Implement P0739R0: 'Some improvements to class template argument deduction ↵Marshall Clow2017-07-271-3/+3
| | | | | | integration into the standard library' This is an API change (not ABI change) due to a late change in the c++17 standard llvm-svn: 309296
* Revert r304955 - Fix class template deduction for scoped_lock.Eric Fiselier2017-06-081-5/+0
| | | | | | | | Richard decided to fix these cases in Clang, even though they are representative of a larger problem for more complex cases. llvm-svn: 304966
* Fix class template deduction for scoped_lock.Eric Fiselier2017-06-081-1/+5
| | | | | | | | | r304862 changed how CTD handles deducing a non-primary class template using a non-dependent constructor of the primary template. This change requires libc++ to provide explicit deduction guides to make scoped_lock work again. llvm-svn: 304955
* [Libc++] Use #pragma push_macro/pop_macro to better handle min/max on WindowsEric Fiselier2017-05-311-2/+6
| | | | | | | | | | | | | | | | Summary: This patch improves how libc++ handles min/max macros within the headers. Previously libc++ would undef them and emit a warning. This patch changes libc++ to use `#pragma push_macro` to save the macro before undefining it, and `#pragma pop_macro` to restore the macros and the end of the header. Reviewers: mclow.lists, bcraig, compnerd, EricWF Reviewed By: EricWF Subscribers: cfe-commits, krytarowski Differential Revision: https://reviews.llvm.org/D33080 llvm-svn: 304357
* Add missing acquire_load to call_once overload.Justin Lebar2017-04-231-1/+1
| | | | | | | | | | | | Summary: Seemed to have been overlooked in D24028. This bug was found and brought to my attention by Paul Wankadia. Reviewers: kubamracek, EricWF, dvyukov Differential Revision: https://reviews.llvm.org/D32402 llvm-svn: 301132
* Cleanup _LIBCPP_HAS_NO_<c++11-feature> macros in thread.Eric Fiselier2017-04-181-15/+15
| | | | llvm-svn: 300622
* Move the scoped_lock inside the '#ifndef NO_THREADS' block to fix the ↵Marshall Clow2017-03-241-79/+78
| | | | | | no-threading build llvm-svn: 298686
* Implement Pp0156r2: 'Variadic Lock Guard, version 5' Reviewed as ↵Marshall Clow2017-03-241-23/+47
| | | | | | https://reviews.llvm.org/D31163. llvm-svn: 298681
* [libc++] Make _LIBCPP_TYPE_VIS export membersShoaib Meenai2017-03-021-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: Most classes annotated with _LIBCPP_TYPE_VIS need to have at least some of their members exported, otherwise we have a lot of link errors when linking against a libc++ built with hidden visibility. This also makes _LIBCPP_TYPE_VIS be consistent across platforms, since on Windows it already exports members. With this change made, any template methods of a class marked _LIBCPP_TYPE_VIS will also get default visibility when instantiatied, which is not desirable for clients of libc++ headers who wish to control their visibility; this is the same issue as PR30642. Annotate all problematic methods with an explicit visibility specifier to avoid this. The problematic methods were found by running bad-visibility-finder [1] against the libc++ headers after making the _LIBCPP_TYPE_VIS change. The small methods were marked for inlining; the larger ones hidden. [1] https://github.com/smeenai/bad-visibility-finder Reviewers: mclow.lists, EricWF Subscribers: cfe-commits Differential Revision: https://reviews.llvm.org/D25208 llvm-svn: 296732
* Revert "Adorn __call_once_proxy with `inline` and `_LIBCPP_INLINE_VISIBILITY`"Justin Bogner2017-01-311-1/+0
| | | | | | | | | | | | | | | While this change didn't really hurt, it does lead to spurious warnings about not being able to override weak symbols if you end up linking objects built with this change to ones built without it. Furthermore, since __call_once_proxy is called indirectly anyway it doesn't actually inline ever. Longer term, it would probably make sense to give this symbol internal visibility instead. This reverts r291497 llvm-svn: 293581
* Adorn __call_once_proxy with `inline` and `_LIBCPP_INLINE_VISIBILITY`Justin Bogner2017-01-091-0/+1
| | | | | | | As per discussion with mclow and EricWF on irc, this is small and simple enough to deserve being inlined. llvm-svn: 291497
* thread_support: split out {,non-}recursive mutexSaleem Abdulrasool2017-01-051-2/+3
| | | | | | | | Split out the recursive and non-recursive mutex. This split is needed for platforms which may use differing types for the two mutex (e.g. Win32 threads). llvm-svn: 291145
* [NFC] Rename _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VISEric Fiselier2017-01-041-4/+4
| | | | | | | | | | | | | The name _LIBCPP_TYPE_VIS_ONLY is no longer accurate because both _LIBCPP_TYPE_VIS and _LIBCPP_TYPE_VIS_ONLY expand to __attribute__((__type_visibility__)) with Clang. The only remaining difference is that _LIBCPP_TYPE_VIS_ONLY can be applied to templates whereas _LIBCPP_TYPE_VIS cannot (due to dllimport/dllexport not being allowed on templates). This patch renames _LIBCPP_TYPE_VIS_ONLY to _LIBCPP_TEMPLATE_VIS. llvm-svn: 291035
* [libcxx] Fix a data race in call_onceKuba Brecka2016-09-041-2/+2
| | | | | | | | call_once is using relaxed atomic load to perform double-checked locking, which contains a data race. The fast-path load has to be an acquire atomic load. Differential Revision: https://reviews.llvm.org/D24028 llvm-svn: 280621
* Fix const default initialization of lock_guard<>Eric Fiselier2016-06-151-1/+1
| | | | llvm-svn: 272804
* Implement variadic lock_guard.Eric Fiselier2016-06-141-0/+91
| | | | | | | | | | | | | | | | | | | | Summary: This patch implements the variadic `lock_guard` paper. Making `lock_guard` variadic is a ABI breaking change because the specialization `lock_guard<_Mutex>` mangles differently then when it was the primary template. This change only provides variadic `lock_guard` in ABI V2 or when `_LIBCPP_ABI_VARIADIC_LOCK_GUARD` is defined. Note that in ABI V2 `lock_guard` must always be declared as a variadic template, even in C++03, in order to keep the ABI consistent. For this reason `lock_guard` is forward declared as a variadic template in all standard dialects and therefore depends on variadic templates being provided as an extension in C++03. All supported versions of Clang and GCC provide this extension. Reviewers: mclow.lists Subscribers: K-ballo, mclow.lists, cfe-commits Differential Revision: http://reviews.llvm.org/D21260 llvm-svn: 272634
* Refactor pthread usage of libcxx.Asiri Rathnayake2016-05-061-12/+10
| | | | | | | | | | | | | This patch extracts out all the pthread dependencies of libcxx into the new header __threading_support. The motivation is to make it easy to re-target libcxx into platforms that do not support pthread. Original patch from Fulvio Esposito (fulvio.esposito@outlook.com) - D11781 Applied with tweaks - D19412 Change-Id: I301111f0075de93dd8129416e06babc195aa936b llvm-svn: 268734
* Do not include pthread.h and sched.h when threads are disabledJonathan Roelofs2015-08-271-0/+2
| | | | | | | | Patch by Philippe Daouadi! http://reviews.llvm.org/D9639 llvm-svn: 246168
* [libcxx] Add atomic_support.h header to src that handles needed atomic ↵Eric Fiselier2015-07-071-2/+3
| | | | | | | | | | | | | | | | | | | | | operations. Summary: In some places in libc++ we need to use the `__atomic_*` builtins. This patch adds a header that provides access to those builtins in a uniform way from within the dylib source. If the compiler building the dylib does not support these builtins then a warning is issued. Only relaxed loads are needed within the headers. A singe function to do these relaxed loads has been added to `<memory>`. This patch applies the new atomic builtins to `__shared_count` and `call_once`. Reviewers: mclow.lists Subscribers: majnemer, jroelofs, cfe-commits Differential Revision: http://reviews.llvm.org/D10406 llvm-svn: 241532
* LWG2442: call_once() shouldn't DECAY_COPY(). Patch from K-Ballo.Eric Fiselier2015-06-131-21/+31
| | | | | | | This patch fixes LWG issue 2422 by removing the DECAY_COPY from call once. The review can be found here: http://reviews.llvm.org/D10191 llvm-svn: 239654
* Explicitly include <sched.h> for sched_yield()Sergey Dmitrouk2014-12-081-0/+1
| | | | | | | | It might be implicitly included by <pthread.h> (and that's why it worked so far), but it's not guaranteed (for example, this is not the case with newlib). llvm-svn: 223661
* Allow libc++ to be built on systems without POSIX threadsJonathan Roelofs2014-09-051-0/+4
| | | | | | | | | | If you're crazy enough to want this sort of thing, then add -D_LIBCPP_HAS_NO_THREADS to your CXXFLAGS and --param=additiona_features=libcpp-has-no-threads to your lit commnad line. http://reviews.llvm.org/D3969 llvm-svn: 217271
* std::once_flag was forward declared with _LIBCPP_TYPE_VIS decoration, and ↵Marshall Clow2014-07-291-1/+1
| | | | | | the defined with _LIBCPP_TYPE_VIS_ONLY decoration. Make them match llvm-svn: 214219
* Nico Rieck: this patch series fixes visibility issues on Windows as ↵Howard Hinnant2013-08-121-2/+2
| | | | | | explained in <http://lists.cs.uiuc.edu/pipermail/cfe-dev/2013-August/031214.html>. llvm-svn: 188192
* No functionality change at this time. I've split _LIBCPP_VISIBLE up into ↵Howard Hinnant2013-03-061-5/+5
| | | | | | two flags: _LIBCPP_TYPE_VIS and _LIBCPP_FUNC_VIS. This is in preparation for taking advantage of clang's new __type_visibility__ attribute. llvm-svn: 176593
* Dimitry Andric: many visibility fixes. Howard: Much appreciated. Can you ↵Howard Hinnant2012-09-141-3/+5
| | | | | | send me a patch to CREDITS.TXT? llvm-svn: 163862
* noexcept and constexpr applied to <mutex>.Howard Hinnant2012-07-211-22/+22
| | | | llvm-svn: 160604
* Quash a whole bunch of warningsHoward Hinnant2011-12-011-1/+1
| | | | llvm-svn: 145624
* Further macro protection by replacing _[A-Z] with _[A-Z]pHoward Hinnant2011-11-291-14/+14
| | | | llvm-svn: 145410
* Add protection from min/max macrosHoward Hinnant2011-11-291-0/+2
| | | | llvm-svn: 145407
* Windows support by Ruben Van Boxem.Howard Hinnant2011-10-171-0/+2
| | | | llvm-svn: 142235
* _STD -> _VSTD to avoid macro clash on windowsHoward Hinnant2011-06-301-5/+5
| | | | llvm-svn: 134190
* I had a giant misunderstanding of what 'synchronizes with' meant in ↵Howard Hinnant2011-05-191-1/+1
| | | | | | [futures.async]/p5. This invalidated the current design of async in <future>. This is a new design, based on my new understanding, which has been confirmed on the lwg mailing list. The summary is that ~future() (and ~shared_future()) will block when they are created from within async, and the thread hasn't finished yet. As part of this work I created two new type traits: __invokable<F, Args...>::value and __invoke_of<F, Args...>::type. These are what result_of<F(Args...)> wanted to be when it grew up, but never will be. __invoke_of is carefully crafted so that it can serve as its own enable_if (type doesn't exist if the signature isn't invokable). All of this work is C++11 only. llvm-svn: 131639
* Brought call_once variadic call up to current spec, which allows move-only ↵Howard Hinnant2011-05-161-4/+41
| | | | | | functors and move-only arguments, but disallows functors with non-const lvalue reference parameters. llvm-svn: 131414
* Fixing an ambiguity in variadics found by clang.Howard Hinnant2011-01-121-9/+9
| | | | llvm-svn: 123337
* N3191: C++ Timeout SpecificationHoward Hinnant2010-11-201-2/+2
| | | | llvm-svn: 119909
* license changeHoward Hinnant2010-11-161-2/+2
| | | | llvm-svn: 119395
* visibility-decoration.Howard Hinnant2010-09-221-5/+12
| | | | llvm-svn: 114559
OpenPOWER on IntegriCloud