summaryrefslogtreecommitdiffstats
path: root/src/corelib/thread/qfutex_p.h
Commit message (Collapse)AuthorAgeFilesLines
* Don't wrap feature detection macros with QT_HAS_FOO() variantsTor Arne Vestbø2019-12-101-2/+2
| | | | | | | | | | | | | | | | | Using wrappers for these macros is problematic when for example passing the -frewrite-includes flag to preprocess sources before shipping off to distcc or Icecream. It will also start producing warnings when compilers implement http://eel.is/c++draft/cpp.cond#7.sentence-2. See for example https://reviews.llvm.org/D49091 Both https://clang.llvm.org/docs/LanguageExtensions.html and the SD-6 document at https://isocpp.org/std/standing-documents/sd-6-sg10-feature-test-recommendations recommend defining '__has_foo(x) 0' as a fallback for compilers without the macros, so that's what we go for. Change-Id: I0298cd3b4a6ff6618821e34642a5ddd6728be767 Reviewed-by: Alex Richardson <arichardson.kde@gmail.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Annotate the futex implementation for TSANGiuseppe D'Angelo2019-05-221-1/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | TSAN does not understand the futex system call. Now, in QMutex and QSemaphore usage, futex is always wrapped by atomic operations that always do an acquire (before waiting) and a release (before waking waiters). That alone realizes a synchronizes-with, and since Qt uses std::atomics, TSAN knows what's going on and does not complain. But what if one uses futex directly, or we change the algorithms, or introduce some other new synchronization primitive somewhere? Luckily TSAN offers annotations for this that we can use. This patch annotates the main entry point for the futex syscall with a pair of acquire/release semantics. A futex call guarantees total ordering on the operations on the futex word(s), whether the call succeeds or fails. Change-Id: Ib80ff898c09fbb6fc73989247eb757bf70971a8a Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Replace Q_DECL_NOEXCEPT with noexcept in corelibAllan Sandfeld Jensen2019-04-031-1/+1
| | | | | | | In preparation of Qt6 move away from pre-C++11 macros. Change-Id: I44126693c20c18eca5620caab4f7e746218e0ce3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add the "we mean it" warning to qfutex_p.hMårten Nordheim2017-09-221-0/+11
| | | | | Change-Id: I77a0899532e2a38fa390991bbad11300672544bf Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Port QSemaphore to use futexesThiago Macieira2017-09-181-9/+12
| | | | | | | | This is interesting because QSemaphore now needs to allocate no memory: it's just a simple 31-bit counter and the contention flag. Change-Id: I6e9274c1e7444ad48c81fffd14dbc0ab42bc2e00 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Move the futex implementation to a headerThiago Macieira2017-09-181-0/+128
So I can use it in QSemaphore and provide a Windows implementation. Change-Id: I6e9274c1e7444ad48c81fffd14dbc0a8e2201302 Reviewed-by: Lars Knoll <lars.knoll@qt.io>