Commit Graph

96 Commits

Author SHA1 Message Date
Max Kellermann d3c7fac606 thread/Thread: throw std::system_error on error 2016-06-17 19:11:20 +02:00
Max Kellermann fea3f6cc72 thread/Thread: use C++11 initialisers 2016-06-17 19:11:19 +02:00
Max Kellermann eca6b9f0af thread/Mutex: add method ScopeLock::Unlock() 2016-05-02 23:32:44 +02:00
Max Kellermann 1d67aa7bf2 update copyright year to 2016 2016-02-26 17:54:05 +01:00
Christian Halaszovich 3392cbbd91 Emit a warning if the OutputThread fails to get realtime scheduling
This only applies to linux systems.  Here, sched_setscheduler() is
called to get realtime scheduling.  With this patch, the return value
of this function is now checked and a warning / error message is
generated if it fails.
2016-02-19 17:09:44 +01:00
Max Kellermann ac1eaff6ec thread/Mutex: add class ScopeUnlock() 2015-12-31 12:30:53 +01:00
Max Kellermann 48d7fedbc0 thread/{Mutex,Cond}: remove obsolete comments 2015-08-25 12:52:13 +02:00
Max Kellermann 75dff64450 thread/Posix{Mutex,Cond}: use "constexpr" only with glibc
Apparently all other C libraries are not compatible with "constexpr".
Those which are not will get a performance penalty, but at least they
work at all.
2015-08-25 12:46:12 +02:00
Max Kellermann ae7e1a22cb Merge branch 'v0.19.x' 2015-01-26 20:57:29 +01:00
Max Kellermann 276a0d9500 thread/Name: include stdio.h if HAVE_PRCTL
Caused a build failure with uClibc because snprintf() was not
available.
2015-01-21 20:40:56 +01:00
Max Kellermann 674d14879f Merge branch 'v0.19.x' 2015-01-06 12:54:46 +01:00
Max Kellermann 4bd2c75056 thread/Name: disable pthread_setname_np() on NetBSD
NetBSD's pthread_setname_np() prototype is incompatible with the rest
of the world, and it requires to pass the string argument as a
non-const pointer.  Instead of working around this misdesign, I hereby
disable the feature on NetBSD.
2015-01-06 12:08:36 +01:00
Max Kellermann b9ed850b98 thread/Name: enable FormatThreadName() with prctl()
Add macro HAVE_THREAD_NAME which is set when any method to set the
thread name is available.  Use that macro in FormatThreadName()
instead of just checking for HAVE_PTHREAD_SETNAME_NP.
2015-01-06 12:04:30 +01:00
Max Kellermann 11cea17496 thread/Name: indent preprocessor commands 2015-01-06 12:04:15 +01:00
Max Kellermann 712ed555e6 Copyright year 2015 2015-01-01 19:48:13 +01:00
Max Kellermann cbc1a58e93 release v0.18.20
-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2
 
 iQIcBAABAgAGBQJUha5vAAoJECNuiljG20USdLEP/0NCwdnvCPVdkZ7RwsdCRp53
 jv86eu92uFVQJrW5/NQahngOwqNRsjNRX1EiEalbEjqCzMxDjuKCBukdteXg0Q2A
 igwDDrDwpm9tvzilsTAdjEH3gRcuxDRWfF259bZXbnxksVMuwzo31YraU6dBUkSc
 qPpQtbS4Op0paFG0TieBAt07TZ8Wb4KkAM86vBu31JpXZkXGyT6B6N3qe4WtpAN8
 l5qAWstBRog5JM3Q99FNDnCFG/2n93CEZjwN8FlQgkFhyhhDKF5YOhZNQpqTEbh9
 nxdo5V3OC42cx92V1CxrzkPKhnBIrSTGLg+Yb9S+vF3nWX+cBPpalr/rw5xZTrdH
 3zER+hOHvkMZpEZDiyUx5bkF9Ay2BvJkdJCSFSTq9HmzksTnEJ+0r44cO2rwqOpx
 R6KZPLTmObjCjmnMM+kbd6e/T8WEkcEotuYoocf3lep45roGAYuHErWW3+B89+4Z
 f0Y8uwPQTWrOGSRKXh2liWcHeN114Uwvb0ZyO+/0Oe7v1Id/IW7zC2XfSpY58dok
 /yRXiElow1LVLISixBBUAnwkx0M+CyQJqCS/nQpedPArLos+g4Wo3R+QnQEnOu9C
 e1cRY3qa56lre6BnE+rQ3aMNVGgfjsU4t3mSjQlCp1PbU7izvlgMHJcyErt6d5aj
 nA8VwjS+1PCODS/HkCqc
 =APdC
 -----END PGP SIGNATURE-----

Merge tag 'v0.18.20' into v0.19.x
2014-12-08 15:03:09 +01:00
Max Kellermann d8fc2db910 thread/Id: drop "::" prefix before pthread function names
The "::" to explicitly refer to the global namespace appeared like a
good idea in C++, but it breaks with C libraries that implement
standard functions using macros (e.g. musl).
2014-12-08 14:17:17 +01:00
Max Kellermann 9270485723 Merge branch 'v0.18.x' 2014-09-24 21:49:20 +02:00
Max Kellermann e304d0f8ee thread/Posix{Cond,Mutex}: don't ues PTHREAD_*_INITIALIZER on NetBSD
On NetBSD, PTHREAD_MUTEX_INITIALIZER and PTHREAD_COND_INITIALIZER are
not compatible with C++11 "constexpr" (see Mantis ticket 0004110).  As
a workaround, don't ues "constexpr", and use the functions
pthread_mutex_init(), pthread_mutex_destroy(), pthread_cond_init() and
pthread_cond_destroy() instead.  This adds some runtime overhead, but
is portable to POSIX implementations that have awkward initializer
macros.
2014-09-13 11:26:17 +02:00
Max Kellermann 56504534d8 thread/{Mutex,Cond}: relicense to BSD-2 2014-07-02 20:09:39 +02:00
Max Kellermann 80a45c91f9 thread/GLib{Mutex,Cond}: remove obsolete classes 2014-07-02 20:09:39 +02:00
Max Kellermann dc14ac7a8f thread/Util: relicense to BSD-2 2014-05-31 12:11:53 +02:00
Max Kellermann d51b90a880 thread/Thread: make the destructor non-virtual
The class does not have any virtual methods, and thus the (debug-only)
destructor does not need to be virtual.
2014-03-16 10:26:23 +01:00
Max Kellermann 7453c26ec4 thread/Name: fall back to prctl() 2014-03-01 23:58:59 +01:00
Max Kellermann 1e06c66c77 java: new helper library for the Android port 2014-03-01 18:48:20 +01:00
Max Kellermann a0c25941a8 Thread/Util: use __NR_ioprio_set instead of SYS_ioprio_set
Bionic doesn't have the SYS_* macros.
2014-02-18 10:44:18 +01:00
Max Kellermann 5eb468bce0 Thread/Util: make SCHED_RESET_ON_FORK optional
Use it if it exists, but don't insist if the C library is poor
(e.g. Bionic/Android).
2014-02-18 10:43:24 +01:00
Max Kellermann 9b7f492c65 thread/Posix{Mutex,Cond}: disable "constexpr" on Android
Bionic's pthread declarations are non-literal.
2014-02-18 09:54:35 +01:00
Max Kellermann a31738f6f1 Main, OutputThread: increase kernel timer slack (Linux)
Allows the kernel to combine timer wakeups with other processes,
reducing power usage.
2014-01-30 18:43:40 +01:00
Max Kellermann 2f873edc9c thread/Name: implementation for Mac OS X
pthread_setname_np() doesn't have the "thread" argument on OS X.
2014-01-28 11:33:15 +01:00
Max Kellermann ec41d849bb thread/Name: set thread names
For debugging.
2014-01-23 10:07:14 +01:00
Max Kellermann 1d547fe273 thread/Util: set the SCHED_RESET_ON_FORK flag in SetThreadRealtime() 2014-01-23 09:14:09 +01:00
Max Kellermann 4734af747b OutputThread: use real-time priority 2014-01-14 09:59:04 +01:00
Max Kellermann 5d17731b73 UpdateGlue: let the update thread run at "idle" priority
The update thread should not affect the rest of the system, therefore
set "idle" priority, and let it only run when nobody else is using the
resources.
2014-01-14 09:09:52 +01:00
Max Kellermann 4f83c60296 copyright year 2014 2014-01-13 22:31:55 +01:00
Max Kellermann 8e676db633 Thread/Thread: replacement library for GThread 2013-10-17 19:29:47 +02:00
Max Kellermann 7c1cf61728 thread/{Cond,Mutex}: use "class" instead of "typedef"
Allows forward-declaration.
2013-10-17 10:06:31 +02:00
Max Kellermann be2951b45f gcc.h: rename to Compiler.h 2013-10-15 09:21:59 +02:00
Max Kellermann d23c907a94 thread/Id: new class replacing GThread pointers
Remove a GLib dependencies from class EventLoop and DatabaseLock.
2013-08-10 09:00:04 +02:00
Max Kellermann c5c43c4541 thread/Cond: add method timed_wait() 2013-04-17 01:33:07 +02:00
Max Kellermann 0226440a2d thread/{Mutex,Cond}: new backend for WIN32
Use CRITICAL_SECTION and CONDITION_VARIABLE.  This requires Windows
Vista or newer.  It fixes problems with GLib threading objects that
were implicitly created by static constructors before g_thread_init().
2013-01-11 11:11:07 +01:00
Max Kellermann 0b93445380 thread/Cond: new wrapper for pthread_cond_t or GCond 2013-01-10 10:03:19 +01:00
Max Kellermann 483ba5ea1c thread/GLibMutex: new Mutex implementation
Switch WIN32 to this implementation to be able to use condition
variables, which is impossible with CriticalSection.
2013-01-10 10:03:18 +01:00
Max Kellermann 51a8c109ab thread/PosixMutex: fix indent 2013-01-10 10:00:52 +01:00
Max Kellermann a68302e50b thread/Mutex: don't use std::mutex
Use a custom pthread_mutex_t wrapper because std::mutex adds overhead.
2013-01-07 10:33:37 +01:00
Max Kellermann efbfe66f21 Mutex: new wrapper for std::mutex, replaces GMutex 2013-01-04 21:24:29 +01:00