summaryrefslogtreecommitdiffstats
path: root/libcxx/src/thread.cpp
Commit message (Collapse)AuthorAgeFilesLines
* [runtimes] Check if pragma comment(lib, ...) is supported firstPetr Hosek2019-05-301-1/+1
| | | | | | | | | This fixes the issue introduced by r362048 where we always use pragma comment(lib, ...) for dependent libraries when the compiler is Clang, but older Clang versions don't support this pragma so we need to check first if it's supported before using it. llvm-svn: 362055
* [runtimes] Support ELF dependent libraries featurePetr Hosek2019-05-301-0/+4
| | | | | | | | | | | | | | | | | | | As of r360984, LLD supports dependent libraries feature for ELF. libunwind, libc++abi and libc++ have library dependencies: libdl librt and libpthread, which means that when libunwind and libc++ are being statically linked (using -static-libstdc++ flag), user has to manually specify -ldl -lpthread which is onerous. This change includes the lib pragma to specify the library dependencies directly in the source that uses those libraries. This doesn't make any difference when using linkers that don't support dependent libraries. However, when using LLD that has dependent libraries feature, users no longer have to manually specifying library dependencies when using static linking, linker will pick the library automatically. Differential Revision: https://reviews.llvm.org/D62090 llvm-svn: 362048
* [WebAssembly] WASI support for libcxxDan Gohman2019-05-011-2/+2
| | | | | | | | | | | | | This adds explicit support for the WASI platform to libcxx. WASI libc uses some components from musl, however it's not fully compatible with musl, so we're planning to stop using _LIBCPP_HAS_MUSL_LIBC and customize for WASI libc specifically. Differential Revision: https://reviews.llvm.org/D61336 Reviewers: sbc100, ldionne llvm-svn: 359703
* 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
* [libcxx] GNU/Hurd uses BSD-based interfaces, but does not (and won't) ↵Louis Dionne2018-11-131-2/+2
| | | | | | | | | | provide <sys/sysctl.h> Reviewed as https://reviews.llvm.org/D54338. Thanks to sthibaul for the patch. llvm-svn: 346763
* Fix Libc++ build with MinGW64Eric Fiselier2017-05-311-1/+1
| | | | | | | | | | | | | | Summary: This patch corrects the build errors I encountered when building on MinGW64. Reviewers: mati865, rnk, compnerd, smeenai, bcraig Reviewed By: mati865, smeenai Subscribers: martell, chapuni, cfe-commits Differential Revision: https://reviews.llvm.org/D33082 llvm-svn: 304360
* Remove usages of _LIBCPP_MSVC which is never definedEric Fiselier2017-05-101-1/+1
| | | | llvm-svn: 302736
* [libcxx] Support threads on FuchsiaPetr Hosek2017-03-011-2/+2
| | | | | | Differential Revision: https://reviews.llvm.org/D30278 llvm-svn: 296573
* Fix the build of thread.cpp on CloudABI.Ed Schouten2017-02-111-2/+2
| | | | | | | CloudABI does provide unistd.h, but doesn't define __unix__. We need to include this header file to make hardware_concurrency work. llvm-svn: 294832
* Threading support: externalize sleep_for() function.Asiri Rathnayake2017-02-091-26/+2
| | | | | | | | | | Different platforms implement the wait/sleep functions in difrerent ways. It makes sense to externalize this into the threading API. Differential revision: https://reviews.llvm.org/D29630 Reviewers: EricWF, joerg llvm-svn: 294573
* Refer to _LIBCPP_MSVC macro where applicableSaleem Abdulrasool2017-02-061-1/+1
| | | | | | | | | Replace preprocess conditions of defined(_MSC_VER) && !defined(__clang__) with defined(_LIBCPP_MSVC). NFC. Patch by Dave Lee! llvm-svn: 294171
* [libcxx] Follow-up to r292107Asiri Rathnayake2017-01-161-5/+5
| | | | | | I've missed a couple of updates. NFC. llvm-svn: 292109
* Ensure Sleep(...) isn't passed the value 0 on WindowsEric Fiselier2017-01-071-1/+1
| | | | llvm-svn: 291342
* thread: implement sleep_for on WindowsSaleem Abdulrasool2017-01-071-0/+7
| | | | | | | | | | Windows does not provide an implementation of `nanosleep`. Round up the time duration to the nearest ms and use `Sleep`. Although this may over-sleep, there is no hard real-time guarantee on the wake, so sleeping a bit more is better than under-sleeping as it within the specification. llvm-svn: 291331
* clean up use of _WIN32Saleem Abdulrasool2017-01-031-5/+6
| | | | | | | | | Replace the use of _WIN32 in libc++. Replace most use with a C runtime check _LIBCPP_MSVCRT or the new _LIBCPP_WIN32 to indicate that we are using the Win32 API. Use a new _LIBCPP_WCHAR_IS_UCS2 to indicate that we are on an environment that has a short wchar_t. llvm-svn: 290910
* Add an _LIBCPP_NORETURN inline function named __throw_XXX for each exception ↵Marshall Clow2016-08-251-6/+4
| | | | | | type we define. They either construct and throw the exception, or abort() (if exceptions are disabled). Use these functions everywhere instead of assert()ing when exceptions are disabled. WARNING: This is a behavior change - but only with exceptions disabled. Reviewed as: https://reviews.llvm.org/D23855. llvm-svn: 279744
* [libcxx] Fix thread join.pass.cpp segfault after r271475Asiri Rathnayake2016-06-031-4/+7
| | | | | | | | | | | | | | | Some pthread implementations do not like being called pthead_join() with the pthread_t argument set to 0, and causes a segfault. This patch fixes this issue by validating the pthread_t argument before invoking pthread_join(). NFC. Differential revision: http://reviews.llvm.org/D20929 Change-Id: Ief817c57bd0e1f43cbaa03061e02417d6a180c38 Reviewers: EricWF llvm-svn: 271634
* Refactor pthread usage of libcxx.Asiri Rathnayake2016-05-061-2/+2
| | | | | | | | | | | | | 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
* [libcxx] Whitelist inclusion of sysctl.h instead of blacklistingBen Craig2016-01-291-3/+8
| | | | | | | | | | | Instead of excluding all known operating systems that are not derived from BSD, I now include all operating systems that claim to be derived from BSD. Hopefully, that will make it so that this check doesn't need to change for every new operating system that comes along. http://reviews.llvm.org/D16634 llvm-svn: 259193
* Don't include <sys/sysctl.h> on CloudABI.Ed Schouten2015-03-101-2/+2
| | | | | | | As CloudABI does not provide sysctl(), this header is not present. Make thread.cpp build correctly (and pass all tests) by not including the header. llvm-svn: 231768
* libc++: support NaCl when building thread.cppJF Bastien2014-12-021-4/+4
| | | | | | | | | | | | | | Summary: NaCl shouldn't include sysctl.h when trying to determine std::thread::hardware_concurrency, it should instead use sysconf(_SC_NPROCESSORS_ONLN) through unistd.h. No test needs to be changed, since hardware_concurrency.pass.cpp already tests that std::thread::hardware_concurrency > 0. Test Plan: make check-libcxx Reviewers: dschuff, danalbert Subscribers: jfb, cfe-commits Differential Revision: http://reviews.llvm.org/D6470 llvm-svn: 223128
* Allow libc++ to be built on systems without POSIX threadsJonathan Roelofs2014-09-051-0/+5
| | | | | | | | | | 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
* Handle partial nanosleeps in this_thread::sleep_forDavid Majnemer2014-06-041-1/+3
| | | | | | | | | | Signals may result in nanosleep returning with only some of the requested sleeping performed. Utilize nanosleep's "time-remaining" out parameter to continue sleeping when this occurs. llvm-svn: 210210
* Switch to using C++ style casts.Joerg Sonnenberger2014-01-041-1/+1
| | | | llvm-svn: 198505
* G M: Provides the _LIBCPP_WARNING macro, to be used for MSVC only, since ↵Howard Hinnant2013-10-041-1/+5
| | | | | | that compiler doesn't support #warning. llvm-svn: 191980
* Xing Xue: port to IBM XLC++/AIX.Howard Hinnant2013-08-141-2/+2
| | | | llvm-svn: 188396
* Windows support in thread::hardware_concurrency.Howard Hinnant2013-07-021-0/+7
| | | | llvm-svn: 185451
* Matthew Dempsky: POSIX defines that the _POSIX_C_SOURCE macros are to be set ↵Howard Hinnant2013-06-301-3/+3
| | | | | | | | | | | | | | | | | | | | by user code to specify what version of POSIX the system should provide. If you want to check what version of POSIX is actually available, you're supposed to test _POSIX_VERSION. However, since sysconf() has been in POSIX since 1995, it's probably safe to assume it's available on any system with a C++11 compiler, especially if _SC_NPROCESSORS_ONLN is defined too. So no point in a complicated preprocessor rule if just we unconditionally include <unistd.h> (on non-Windows systems). Also, I've added a #warning for to help porters detect when a suitable implementation isn't detected at compile-time. Howard: Matthew, can you patch CREDITS.TXT? Thanks. llvm-svn: 185275
* Create a weak pthread_create reference on NetBSD to not force aJoerg Sonnenberger2013-05-171-0/+4
| | | | | | dependency on libpthread for code that doesn't use threads itself. llvm-svn: 182161
* Bruce Mitchener, Jr.: Port to emscripten. Fixes ↵Howard Hinnant2013-03-291-1/+1
| | | | | | http://llvm.org/bugs/show_bug.cgi?id=15624. llvm-svn: 178354
* Fix a few warnings/errors for compiling with -fno-exceptions.Howard Hinnant2013-03-281-0/+2
| | | | llvm-svn: 178267
* Removed raw references to __sun__, __FreeBSD__, __GLIBC__ and __linux__; now ↵Marshall Clow2013-03-181-1/+1
| | | | | | just check to see if they are defined. llvm-svn: 177310
* Removed raw references to _WIN32; now just check to see if it is defined.Marshall Clow2013-03-181-1/+1
| | | | llvm-svn: 177291
* Belt and suspenders when calling sysconfMarshall Clow2013-02-071-1/+3
| | | | llvm-svn: 174642
* Another libc++ warning suppression on Linux; no functionality changeMarshall Clow2013-02-071-1/+1
| | | | llvm-svn: 174637
* Saleem Abdulrasool: cleanup a few more compile warnings emitted by GCC.Howard Hinnant2012-12-271-2/+4
| | | | llvm-svn: 171173
* Change sleep_for, sleep_until, and the condition_variable timed waitHoward Hinnant2012-08-301-3/+15
| | | | | | | | | | | | | functions to protect against duration and time_point overflow. Since we're about to wait anyway, we can afford to spend a few more cycles on this checking. I purposefully did not treat the timed try_locks with overflow checking. This fixes http://llvm.org/bugs/show_bug.cgi?id=13721 . I'm unsure if the standard needs clarification in this area, or if this is simply QOI. The <chrono> facilities were never intended to overflow check, but just to not overflow if durations stayed within +/- 292 years. llvm-svn: 162925
* Andrew Morrow: The attached patch is an attempt to implementHoward Hinnant2012-08-021-2/+11
| | | | | | | std::thread::hardware_concurrency for platforms that don't offer sysctl, but do provide a POSIX sysconf and _SC_NPROCESSORS_ONLN. llvm-svn: 161190
* noexcept applied to <thread>.Howard Hinnant2012-07-211-1/+1
| | | | llvm-svn: 160606
* Solaris port. Currently sees around 200 test failures, mostly related toDavid Chisnall2012-02-291-1/+1
| | | | | | | | | | Solaris not providing some of the locales that the test suite uses. Note: This depends on an xlocale (partial) implementation for Solaris and a couple of fixed standard headers. These will be committed to a branch later today. llvm-svn: 151720
* Quash a whole bunch of warningsHoward Hinnant2011-12-011-1/+1
| | | | llvm-svn: 145624
* Work on Windows port by Ruben Van BoxemHoward Hinnant2011-09-231-0/+2
| | | | llvm-svn: 140384
* Effort to reduce the number of exported symbolsHoward Hinnant2010-12-171-3/+18
| | | | llvm-svn: 122057
* license changeHoward Hinnant2010-11-161-2/+2
| | | | llvm-svn: 119395
* Convert __thread_local_data to the singleton patternHoward Hinnant2010-10-141-1/+6
| | | | llvm-svn: 116500
* [futures.atomic_future] and notify_all_at_thread_exit. This completes the ↵Howard Hinnant2010-09-031-0/+22
| | | | | | header <future> and all of Chapter 30 (for C++0x enabled compilers). llvm-svn: 113017
* future continues ...Howard Hinnant2010-08-271-0/+55
| | | | llvm-svn: 112284
* Fixing whitespace problemsHoward Hinnant2010-08-221-4/+4
| | | | llvm-svn: 111751
* now works with -fno-exceptions and -fno-rttiHoward Hinnant2010-08-111-0/+4
| | | | llvm-svn: 110828
* For compiling on FreeBSDHoward Hinnant2010-05-251-0/+1
| | | | llvm-svn: 104616
OpenPOWER on IntegriCloud