summaryrefslogtreecommitdiff
path: root/src/common/compat_threads.c
AgeCommit message (Collapse)Author
2018-06-22Extract the locking and logging codeNick Mathewson
The locking code gets its own module, since it's more fundamental than the higher-level locking code. Extracting the logging code was the whole point here. :)
2018-06-20Run rectify_include_paths.pyNick Mathewson
2018-06-20Update copyrights to 2018.Nick Mathewson
2017-12-08Merge branch 'macro_free_v2_squashed'Nick Mathewson
2017-12-08Convert the rest of src/common's headers to use FREE_AND_NULLNick Mathewson
2017-11-21re-run ./scripts/maint/annotate_ifdef_directivesNick Mathewson
2017-11-21Use stdatomic.h for atomic_counter_t where available.Nick Mathewson
Closes ticket 23953.
2017-09-15Run our #else/#endif annotator on our source code.Nick Mathewson
2017-04-26Fix coverity cid 1405509Sebastian Hahn
Locking in the init function is not necessary, but coverity gets confused about it. So let's trick it.
2017-04-25Whitespace fixes.Nick Mathewson
2017-04-25Use atomic counters for compressor allocation.Nick Mathewson
2017-03-16Now, resolve a new 64-bit warning in compat_threads.cNick Mathewson
2017-03-15Run the copyright update script.Nick Mathewson
2017-03-15Correctly handle fd-drain errors on windows workqueuesNick Mathewson
Windows doesn't let you check the socket error for a socket with WSAGetLastError() and getsockopt(SO_ERROR). But getsockopt(SO_ERROR) clears the error on the socket, so you can't call it more than once per error. When we introduced recv_ni to help drain alert sockets, back in 0.2.6.3-alpha, we had the failure path for recv_ni call getsockopt() twice, though: once to check for EINTR and one to check for EAGAIN. Of course, we never got the eagain, so we treated it as an error, and warned about: "No error". The fix here is to have these functions return -errno on failure. Fixes bug 21540; bugfix on 0.2.6.3-alpha.
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-08-07Check for EINTR correctly on windowsNick Mathewson
(even though these are nonblocking calls and EINTR shouldn't be possible). Also, log what error we're seing if drain_fn fails.
2015-01-30Fix: check r < 0 before checking errnoDavid Goulet
Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-01-30Fix possible infinite loop on pipe/sock_drain()David Goulet
If the returned value of read/recv is 0 (meaning EOF), we'll end up in an infinite loop (active wait) until something is written on the pipe which is not really what we want here especially because those functions are called from the main thread. Signed-off-by: David Goulet <dgoulet@ev0ke.net>
2015-01-22fix some warnings in compat_threads.cNick Mathewson
2015-01-22Move a redundant _GNU_SOURCE to where it is not redundantNick Mathewson
2015-01-21handle EINTR in compat_*threads.cNick Mathewson
2015-01-14Fix check-spacesNick Mathewson
2015-01-14"Recursive" locks, not "reentrant" locks. Duh.Nick Mathewson
2015-01-14Fix linux compilation (pipe2 needs _GNU_SOURCE)Nick Mathewson
2015-01-14Test a little more of compat_threads.cNick 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-14Isolate the "socketpair or a pipe" logic for alerting main threadNick Mathewson
This way we can use the linux eventfd extension where available. Using EVFILT_USER on the BSDs will be a teeny bit trickier, and will require libevent hacking.
2015-01-14Add tor_cond_init/uninitNick Mathewson
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.