aboutsummaryrefslogtreecommitdiff
path: root/src/common/compat_pthreads.c
AgeCommit message (Collapse)Author
2017-09-15Run our #else/#endif annotator on our source code.Nick Mathewson
2017-09-15Split some long #if lines to make the #endif annotator happyNick Mathewson
2017-03-15Run the copyright update script.Nick Mathewson
2016-09-24Merge branch 'osx_sierra_028'Nick Mathewson
2016-09-24Fix pthread_cond_timedwait() on OSX SierraNick Mathewson
Sierra provides clock_gettime(), but not pthread_condattr_setclock. So we had better lot try to use CLOCK_MONOTONIC as our source for time when waiting, since we ccan never actually tell the condition that we mean CLOCK_MONOTONIC. This isn't a tor bug yet, since we never actually pass a timeout to tor_cond_wait() outside of the unit tests.
2016-09-24Fix compilation on OSX Sierra (10.12)Nick Mathewson
2016-06-19Merge remote-tracking branch 'public/thread_coverage'Nick Mathewson
2016-06-17Use the Autoconf macro AC_USE_SYSTEM_EXTENSIONScypherpunks
The Autoconf macro AC_USE_SYSTEM_EXTENSIONS defines preprocessor macros which turn on extensions to C and POSIX. The macro also makes it easier for developers to use the extensions without needing (or forgetting) to define them manually. The macro can be safely used because it was introduced in Autoconf 2.60 and Tor requires Autoconf 2.63 and above.
2016-06-08Mark the unreachable lines in compat_{,p}threads and workqueueNick Mathewson
These are all related to failures from functions that either can't fail as we call them, or where we cannot provoke failure.
2016-02-27Update the copyright year.Nick Mathewson
2016-02-27Add a brief file-level description for everything in src/commonNick Mathewson
2015-12-16Don't call pthread_condattr_setclock() unless it existsNick Mathewson
Fixes bug 17819; bugfix on 0.2.6.3-alpha (specifically, d684dbb0).
2015-08-18Use thread-local storage to block event_queue recursion.Nick Mathewson
2015-07-21Fix some potential memory leaks in the thread pool code.cypherpunks
2015-06-03Fix an incorrect comment on spawn_functeor
spawn_func calls pthread_create on unix, not fork Fix on existing code split out of compat.c into compat_pthreads.c in c2f0d52b7fb9
2015-03-13const-ify the new failure vars, and one old oneNick Mathewson
2015-03-12don't init threads as side effect of assertionSebastian Hahn
Fixes part of bug 15211.
2015-03-12Use PTHREAD_CREATE_DETACHED macro instead of 1: fix Solaris crashNick Mathewson
When calling pthread_attr_setdetachstate, we were using 1 as the argument. But the pthreads documentation says that you have to say PTHREAD_CREATE_DETACH, which on Solaris is apparently 0x40. Calling pthread_attr_setdetachstate with 1 crashes on Solaris with FLTBOUNDS. (Because we're so late in the release cycle, I made the code define PTHREAD_CREATE_DETACHED if it doesn't exist, so we aren't likely to break any other platforms.) This bug was introduced when we made threading mandatory in 0.2.6.1-alpha; previously, we had force-disabled threading on Solaris. See #9495 discussion.
2015-01-22Move a redundant _GNU_SOURCE to where it is not redundantNick Mathewson
2015-01-21Support monotonic time for pthread_cond_timedwaitDavid Goulet
This is to avoid that the pthread_cond_timedwait() is not affected by time adjustment which could make the waiting period very long or very short which is not what we want in any cases. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-01-21Fix up some workqueue/threading issues spotted by dgoulet.Nick Mathewson
2015-01-21handle EINTR in compat_*threads.cNick Mathewson
2015-01-15Update workqueue implementation to use a single queue for the workNick Mathewson
Previously I used one queue per worker; now I use one queue for everyone. The "broadcast" code is gone, replaced with an idempotent 'update' operation.
2015-01-14Fix check-spacesNick Mathewson
2015-01-14"Recursive" locks, not "reentrant" locks. Duh.Nick Mathewson
2015-01-14Use correct (absolute) time for pthread_cond_timedwaitNick Mathewson
2015-01-14Rename mutex_for_cond -> mutex_nonreentrantNick Mathewson
We'll want to use these for other stuff too.
2015-01-14Documentation for new workqueue and condition and locking stuffNick Mathewson
2015-01-14Specialize handling for mutexes allocated for condition variablesNick Mathewson
(These must not be reentrant mutexes with pthreads.)
2015-01-14Add tor_cond_init/uninitNick Mathewson
2015-01-14Add a timeout to tor_cond_wait; add tor_cond impl from libeventNick Mathewson
The windows code may need some tweaks for it to compile; I've not tested it yet.
2015-01-14Split threading-related code out of compat.cNick Mathewson
Also, re-enable the #if'd out condition-variable code. Work queues are going to make us hack on all of this stuff a bit more closely, so it might not be a terrible idea to make it easier to hack.