summaryrefslogtreecommitdiff
path: root/src/thread
AgeCommit message (Collapse)Author
2021-01-01copyright year 2021Max Kellermann
2020-03-17thread/CriticalSection: remove extra semicolonsMax Kellermann
2020-03-16remove some more extra semicolonsRosen Penev
Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16Merge remote-tracking branches 'neheb/fwhfggwe', 'neheb/nvm2', ↵Max Kellermann
'neheb/nvm22', 'neheb/bvm' and 'neheb/cl2'
2020-03-16remove extra semicolonRosen Penev
Found with -Wextra-semi Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-16remove gcc_unusedRosen Penev
[[maybe_unused]] (introduced in C++17) is standard C++. https://clang.llvm.org/docs/AttributeReference.html#maybe-unused-unused says that this is equivalent to the GNU unused attribute. Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-03-12replace assert.h with cassertRosen Penev
The former was deprecated with C++14. According to the C++11 and C++17 standards, both files are identical. Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-01-18copyright year 2020Max Kellermann
2019-10-09thread/Util: lower the real-time priority from 50 to 40Max Kellermann
On linux-rt, kernel IRQ threads are configured with priority=50, and this change configures MPD somewhat below that priority, leaving some room for other programs to be configured in between. Closes https://github.com/MusicPlayerDaemon/MPD/issues/643
2019-08-03switch to C++17Max Kellermann
Time to move on, two years after 2017.
2019-06-17Copyright year 2019Max Kellermann
2019-05-29thread/Slack: use std::chrono::durationMax Kellermann
2019-05-07thread/WindowsCond: add wait() overload with predicateMax Kellermann
2019-05-07thread/{Mutex,Cond}: use std::mutex and std::condition_variableMax Kellermann
On Windows, we keep using our own implementations, because GCC implements std::mutex and std::condition_variable with pthread emulation, which is not a good choice.
2019-05-07thread/*Cond: add wait_for() overload with predicateMax Kellermann
2019-05-07thread/*Cond: remove wait() overloads without std::unique_lock<>Max Kellermann
2019-05-07thread/Mutex: use `using` instead of making it a derived classMax Kellermann
Prepare the transition to std::mutex.
2019-04-26thread/Cond: add wait() overload which takes a unique_lock<>Max Kellermann
Just like std::condition_variable, which however has no way to specify the std::mutex directly.
2019-04-25thread/*Cond: rename methods to match std::condition_variableMax Kellermann
2019-03-14meson.build: remove the libwinpthread-1.dll dependency on WindowsMax Kellermann
Closes https://github.com/MusicPlayerDaemon/MPD/issues/507
2018-11-19check.h: remove obsolete headerMax Kellermann
Since we switched from autotools to Meson in commit 94592c14062d5afc9482d11baa401648082022c0, we don't need to include `config.h` early to properly enable large file support. Meson passes the required macros on the compiler command line instead of defining them in `config.h`. This means we can include `config.h` at any time, whenever we want to check its macros, and there are no ordering constraints.
2018-11-19src/thread/meson.build: detect pthread_setname_np()Max Kellermann
This compile-time check got lost during the Meson transition.
2018-10-31*: copyright year 2018Max Kellermann
2018-10-31fix compilation errors on Debian GNU/HurdFlorian Schlichting
Apparently on hurd-i386 __GLIBC__ is defined, but the pthread implementation is special and cannot be used with constexpr. Hence exclude __gnu_hurd__.
2018-10-14build with Meson instead of autotoolsMax Kellermann
So long, autotools! This is my last MPD related project to migrate away from it. It has its strengths, but also very obvious weaknesses and weirdnesses. Today, many of its quirks are not needed anymore, and are cumbersome and slow. Now welcome our new Meson overlords!
2018-09-21Thread/Thread: disallow copyingMax Kellermann
2018-09-21Thread/Thread: document Start() exceptionMax Kellermann
2018-08-20Compiler.h: move to util/Max Kellermann
2018-07-16use uint_least32_t instead of long for timeoutYue Wang
2018-07-15Support timed_wait in microseconds levelYue Wang
Some Audio plugin (such as ALSA, and soon CoreAudio) already support microsecond level buffer time. However, current interval less than 1000 microseconds will cause a bug that the code treated as 0 ms.
2018-02-11Merge tag 'v0.20.17'Max Kellermann
release v0.20.17
2018-02-09thread/Util: implement system call wrapper for sched_setscheduler()Max Kellermann
There is a POSIX definition for sched_setscheduler(), but Linux does not implement that; instead of changing the process's scheduler, it only affects one thread. This has caused some confusion among application developers and C library developers. While glibc implements Linux semantics, Musl has made their sched_setscheduler() function an always-failing no-op, causing the error message "sched_setscheduler failed: Function not implemented". http://git.musl-libc.org/cgit/musl/commit/src/sched/sched_setscheduler.c?id=1e21e78bf7a5c24c217446d8760be7b7188711c2 Instead of relying on the C library which may be unreliable here, we now roll our own system call wrapper. Closes #218
2018-02-09thread/Util: rename ioprio_set() to linux_ioprio_set()Max Kellermann
Juse in cas glibc gets a wrapper for the system call which would then conflict with ours.
2018-01-24util/StringFormat: new utility libraryMax Kellermann
2018-01-15Merge branch 'v0.20.x'Max Kellermann
2018-01-08thread/Thread: add debug attribute "inside_handle"Max Kellermann
This attribute shall be used only for IsInside() to make this safe against a race condition described in #188: > There is no requirement on the implementation that the ID of the > created thread be available before the newly created thread starts > executing. http://pubs.opengroup.org/onlinepubs/009695399/functions/pthread_create.html): This means that on some pthread implementations (e.g. Haiku), the assert(thread.IsInside()) could fail. Closes #188
2018-01-08thread/Thread: make IsInside() debug-onlyMax Kellermann
This method is only used inside assert().
2018-01-08thread/Thread: fix indentMax Kellermann
2018-01-07thread/{Thread,Id}: use defaul-initialized pthread_t as "undefined" valueMax Kellermann
Use the "==" operator instead of pthread_equal(). This allows us to eliminate two boolean flags which are there to avoid race conditions, and made the thing so fragile that I got tons of (correct) thread sanitizer warnings.
2018-01-07thread/Thread: use BoundMethodMax Kellermann
2018-01-07thread/Thread: move code to Run()Max Kellermann
2018-01-05Merge branch 'v0.20.x'Max Kellermann
2018-01-04thread/Util: no ioprio_set() on Android due to seccomp/SIGSYSMax Kellermann
2018-01-02thread/SafeSingleton: disallow copyingMax Kellermann
2018-01-02thread/SafeSingleton: pass parameters to constructorMax Kellermann
2018-01-02thread/SafeSingleton: new thread-safe utility classMax Kellermann
2017-12-22thread/{Thread,Id}: use defaul-initialized pthread_t as "undefined" valueMax Kellermann
Use the "==" operator instead of pthread_equal(). This allows us to eliminate two boolean flags which are there to avoid race conditions, and made the thing so fragile that I got tons of (correct) thread sanitizer warnings.
2017-12-18thread/PosixMutex: add "noexcept"Max Kellermann
2017-12-16Merge branch 'v0.20.x'Max Kellermann
2017-12-12*: check defined(_WIN32) instead of defined(WIN32)Max Kellermann
Only _WIN32 is defined by the compiler, and WIN32 is not standardized and may be missing. Closes #169