aboutsummaryrefslogtreecommitdiff
path: root/src/sync.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove unused LockAssertion structHennadii Stepanov2020-09-191-14/+0
|
* sync.h: Make runtime lock checks require compile-time lock checksAnthony Towns2020-08-291-4/+6
|
* Do not hide compile-time thread safety warningsHennadii Stepanov2020-08-291-2/+2
|
* test: Add LockStackEmpty()Hennadii Stepanov2020-08-021-6/+8
|
* Add means to handle negative capabilities in thread safety annotationsHennadii Stepanov2020-06-111-0/+6
|
* Use template function instead of void* parameterHennadii Stepanov2020-05-281-2/+4
| | | | This change gets rid of -Wthread-safety-attributes warning spam.
* refactor: Add interfaces::FoundBlock class to selectively return block dataRussell Yanofsky2020-03-311-1/+1
| | | | | | | | | | FoundBlock class allows interfaces::Chain::findBlock to return more block information without having lots of optional output parameters. FoundBlock class is also used by other chain methods in upcoming commits. There is mostly no change in behavior. Only exception is CWallet::RescanFromTime now throwing NonFatalCheckError instead of std::logic_error.
* Fix missing header in sync.hJoão Barbosa2020-03-151-2/+2
|
* sync.h: add REVERSE_LOCKAnthony Towns2020-03-061-0/+39
|
* scripted-diff: Bump copyright of files changed in 2020MarcoFalke2020-01-151-1/+1
| | | | | | -BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
* scripted-diff: Replace CCriticalSection with RecursiveMutexMarcoFalke2020-01-151-1/+0
| | | | | | | | | -BEGIN VERIFY SCRIPT- # Delete outdated alias for RecursiveMutex sed -i -e '/CCriticalSection/d' ./src/sync.h # Replace use of outdated alias with RecursiveMutex sed -i -e 's/CCriticalSection/RecursiveMutex/g' $(git grep -l CCriticalSection) -END VERIFY SCRIPT-
* scripted-diff: Bump copyright of files changed in 2019MarcoFalke2019-12-301-1/+1
| | | | | | -BEGIN VERIFY SCRIPT- ./contrib/devtools/copyright_header.py update ./ -END VERIFY SCRIPT-
* refactor: consolidate PASTE macrosJames O'Beirne2019-09-251-3/+1
|
* scripted-diff: Rename LockAnnotation to LockAssertionpracticalswift2019-05-171-3/+3
| | | | | | -BEGIN VERIFY SCRIPT- git grep -l LockAnnotation | xargs sed -i 's/LockAnnotation/LockAssertion/' -END VERIFY SCRIPT-
* Make sure the compile-time locking promises given via LockAnnotation:s hold ↵practicalswift2019-05-171-0/+3
| | | | also in practice at runtime (ifdef DEBUG_LOCKORDER)
* Move LockAnnotation from threadsafety.h (imported code) to sync.h (our code)practicalswift2019-05-171-0/+11
|
* Add WITH_LOCK macro: run code while locking a mutexAntoine Riard2019-04-201-0/+10
| | | | | Results from ryanofksy suggestion on isPotentialTip/ waitForNotifications refactoring
* sync: Add RecursiveMutex type aliasMarcoFalke2018-12-141-1/+2
|
* scripted-diff: Small locking renameRussell Yanofsky2018-08-311-9/+6
| | | | | | | | | | | | | | | | | | | | | | | Call sync.h primitives "locks" and "mutexes" instead of "blocks" and "waitable critical sections" to match current coding conventions and c++11 standard names. This PR does not rename the "CCriticalSection" class (though this could be done as a followup) because it is used everywhere and would swamp the other changes in this PR. Plain mutexes should mostly be preferred instead of recursive mutexes in new code anyway. -BEGIN VERIFY SCRIPT- set -x set -e ren() { git grep -l $1 | xargs sed -i s/$1/$2/; } ren CCriticalBlock UniqueLock ren CWaitableCriticalSection Mutex ren CConditionVariable std::condition_variable ren cs_GenesisWait g_genesis_wait_mutex ren condvar_GenesisWait g_genesis_wait_cv perl -0777 -pi -e 's/.*typedef.*condition_variable.*\n\n?//g' src/sync.h -END VERIFY SCRIPT-
* Merge #11640: Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSectionWladimir J. van der Laan2018-08-311-48/+57
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | 9c4dc597ddc66acfd58a945a5ab11f833731abba Use LOCK macros for non-recursive locks (Russell Yanofsky) 1382913e61f5db6ba849b1e261e8aefcd5a1ae68 Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSection (Russell Yanofsky) ba1f095aadf29bddb0bd8176d2e0b908f92a5623 MOVEONLY Move AnnotatedMixin declaration (Russell Yanofsky) 41b88e93375d57db12da923f45f87b9a2db8e730 Add unit test for DEBUG_LOCKORDER code (Russell Yanofsky) Pull request description: Make LOCK macros work with non-recursive mutexes, and use wherever possible for better deadlock detection. Also add unit test for DEBUG_LOCKORDER code. Tree-SHA512: 64ef209307f28ecd0813a283f15c6406138c6ffe7f6cbbd084161044db60e2c099a7d0d2edcd1c5e7770a115e9b931b486e86c9a777bdc96d2e8a9f4dc192942
| * Use LOCK macros for non-recursive locksRussell Yanofsky2018-08-031-3/+0
| | | | | | | | Instead of std::unique_lock.
| * Make LOCK, LOCK2, TRY_LOCK work with CWaitableCriticalSectionRussell Yanofsky2018-08-031-28/+33
| | | | | | | | | | | | | | | | They should also work with any other mutex type which std::unique_lock supports. There is no change in behavior for current code that calls these macros with CCriticalSection mutexes.
| * MOVEONLY Move AnnotatedMixin declarationRussell Yanofsky2018-08-031-24/+24
| | | | | | | | | | Move AnnotatedMixin closer to where it's used, and after the DEBUG_LOCKORDER function declarations so it can call them.
| * Add unit test for DEBUG_LOCKORDER codeRussell Yanofsky2018-08-031-0/+7
| |
* | Update copyright headers to 2018DrahtBot2018-07-271-1/+1
|/
* Annotate AssertLockHeld() with ASSERT_CAPABILITY() for thread safety analysisJesse Cohen2018-07-251-2/+2
|
* Increment MIT Licence copyright header year on files modified in 2017Akira Takizawa2018-01-031-1/+1
|
* Switched sync.{cpp,h} to std threading primitives.Thomas Snider2017-11-181-10/+6
|
* scripted-diff: Replace #include "" with #include <> (ryanofsky)MeshCollider2017-11-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | -BEGIN VERIFY SCRIPT- for f in \ src/*.cpp \ src/*.h \ src/bench/*.cpp \ src/bench/*.h \ src/compat/*.cpp \ src/compat/*.h \ src/consensus/*.cpp \ src/consensus/*.h \ src/crypto/*.cpp \ src/crypto/*.h \ src/crypto/ctaes/*.h \ src/policy/*.cpp \ src/policy/*.h \ src/primitives/*.cpp \ src/primitives/*.h \ src/qt/*.cpp \ src/qt/*.h \ src/qt/test/*.cpp \ src/qt/test/*.h \ src/rpc/*.cpp \ src/rpc/*.h \ src/script/*.cpp \ src/script/*.h \ src/support/*.cpp \ src/support/*.h \ src/support/allocators/*.h \ src/test/*.cpp \ src/test/*.h \ src/wallet/*.cpp \ src/wallet/*.h \ src/wallet/test/*.cpp \ src/wallet/test/*.h \ src/zmq/*.cpp \ src/zmq/*.h do base=${f%/*}/ relbase=${base#src/} sed -i "s:#include \"\(.*\)\"\(.*\):if test -e \$base'\\1'; then echo \"#include <\"\$relbase\"\\1>\\2\"; else echo \"#include <\\1>\\2\"; fi:e" $f done -END VERIFY SCRIPT-
* Merge #10286: Call wallet notify callbacks in scheduler thread (without cs_main)Wladimir J. van der Laan2017-11-151-0/+3
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 89f0312 Remove redundant pwallet nullptr check (Matt Corallo) c4784b5 Add a dev notes document describing the new wallet RPC blocking (Matt Corallo) 3ea8b75 Give ZMQ consistent order with UpdatedBlockTip on scheduler thread (Matt Corallo) cb06edf Fix wallet RPC race by waiting for callbacks in sendrawtransaction (Matt Corallo) e545ded Also call other wallet notify callbacks in scheduler thread (Matt Corallo) 17220d6 Use callbacks to cache whether wallet transactions are in mempool (Matt Corallo) 5d67a78 Add calls to CWallet::BlockUntilSyncedToCurrentChain() in RPCs (Matt Corallo) 5ee3172 Add CWallet::BlockUntilSyncedToCurrentChain() (Matt Corallo) 0b2f42d Add CallFunctionInQueue to wait on validation interface queue drain (Matt Corallo) 2b4b345 Add ability to assert a lock is not held in DEBUG_LOCKORDER (Matt Corallo) 0343676 Call TransactionRemovedFromMempool in the CScheduler thread (Matt Corallo) a7d3936 Add a CValidationInterface::TransactionRemovedFromMempool (Matt Corallo) Pull request description: Based on #10179, this effectively reverts #9583, regaining most of the original speedups of #7946. This concludes the work of #9725, #10178, and #10179. See individual commit messages for more information. Tree-SHA512: eead4809b0a75d1fb33b0765174ff52c972e45040635e38cf3686cef310859c1e6b3c00e7186cbd17374c6ae547bfbd6c1718fe36f26c76ba8a8b052d6ed7bc9
| * Add ability to assert a lock is not held in DEBUG_LOCKORDERMatt Corallo2017-10-131-0/+3
| |
* | Fix -Wthread-safety-analysis warnings. Change the sync.h primitives to std ↵Matt Corallo2017-11-061-22/+24
|/ | | | | | | | | | | | | | | | from boost. Commit 1. This code was written by @TheBlueMatt in the following branch: * https://github.com/TheBlueMatt/bitcoin/commits/2017-08-test-10923 This commit message was written by me (@practicalswift) who also squashed @TheBlueMatt's commits into one and tried to summarize the changes made. Commit 2. Remove boost include. Remove boost mentions in comments.
* Declare single-argument (non-converting) constructors "explicit"practicalswift2017-08-161-2/+2
| | | | In order to avoid unintended implicit conversions.
* Merge #9964: Add const to methods that do not modify the object for which it ↵MarcoFalke2017-08-161-1/+1
|\ | | | | | | | | | | | | | | | | | | is called 6e8c48dc5 Add const to methods that do not modify the object for which it is called (practicalswift) Pull request description: Tree-SHA512: a6888111ba16fb796e320e60806e1a77d36f545989b5405dc7319992291800109eab0b8e8c286b784778f41f1ff5289e7cb6b4afd7aec77f385fbcafc02cffc1
| * Add const to methods that do not modify the object for which it is calledpracticalswift2017-07-251-1/+1
| |
* | scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift2017-08-071-1/+1
|/ | | | | | | | | | | | | instead of the macro NULL -BEGIN VERIFY SCRIPT- sed -i 's/\<NULL\>/nullptr/g' src/*.cpp src/*.h src/*/*.cpp src/*/*.h src/qt/*/*.cpp src/qt/*/*.h src/wallet/*/*.cpp src/wallet/*/*.h src/support/allocators/*.h sed -i 's/Prefer nullptr, otherwise SAFECOOKIE./Prefer NULL, otherwise SAFECOOKIE./g' src/torcontrol.cpp sed -i 's/tor: Using nullptr authentication/tor: Using NULL authentication/g' src/torcontrol.cpp sed -i 's/METHODS=nullptr/METHODS=NULL/g' src/test/torcontrol_tests.cpp src/torcontrol.cpp sed -i 's/nullptr certificates/NULL certificates/g' src/qt/paymentserver.cpp sed -i 's/"nullptr"/"NULL"/g' src/torcontrol.cpp src/test/torcontrol_tests.cpp -END VERIFY SCRIPT-
* Remove unused Boost includespracticalswift2017-06-091-1/+0
|
* Remove unused codepracticalswift2017-03-171-1/+0
|
* Break addnode out from the outbound connection limits.Gregory Maxwell2017-01-051-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously addnodes were in competition with outbound connections for access to the eight outbound slots. One result of this is that frequently a node with several addnode configured peers would end up connected to none of them, because while the addnode loop was in its two minute sleep the automatic connection logic would fill any free slots with random peers. This is particularly unwelcome to users trying to maintain links to specific nodes for fast block relay or purposes. Another result is that a group of nine or more nodes which are have addnode configured towards each other can become partitioned from the public network. This commit introduces a new limit of eight connections just for addnode peers which is not subject to any of the other connection limitations (including maxconnections). The choice of eight is sufficient so that under no condition would a user find themselves connected to fewer addnoded peers than previously. It is also low enough that users who are confused about the significance of more connections and have gotten too copy-and-paste happy will not consume more than twice the slot usage of a typical user. Any additional load on the network resulting from this will likely be offset by a reduction in users applying even more wasteful workaround for the prior behavior. The retry delays are reduced to avoid nodes sitting around without their added peers up, but are still sufficient to prevent overly aggressive repeated connections. The reduced delays also make the system much more responsive to the addnode RPC. Ban-disconnects are also exempted for peers added via addnode since the outbound addnode logic ignores bans. Previously it would ban an addnode then immediately reconnect to it. A minor change was also made to CSemaphoreGrant so that it is possible to re-acquire via an object whos grant was moved.
* Increment MIT Licence copyright header year on files modified in 2016isle29832016-12-311-1/+1
| | | | | | Edited via: $ contrib/devtools/copyright_header.py update .
* Do not shadow LOCK's criticalblock variable for LOCK inside LOCKPavel Janík2016-08-061-1/+4
|
* Clean up lockorder data of destroyed mutexesPieter Wuille2016-04-101-12/+21
| | | | | | | | | | | | | | | The lockorder potential deadlock detection works by remembering for each lock A that is acquired while holding another B the pair (A,B), and triggering a warning when (B,A) already exists in the table. A and B in the above text are represented by pointers to the CCriticalSection object that is acquired. This does mean however that we need to clean up the table entries that refer to any critical section which is destroyed, as it memory address can potentially be used for another unrelated lock in the future. Implement this clean up by remembering not only the pairs in forward direction, but also backward direction. This allows for fast iteration over all pairs that use a deleted CCriticalSection in either the first or the second position.
* Bump copyright headers to 2015MarcoFalke2015-12-131-1/+1
|
* typofixes (found by misspell_fixer)Veres Lajos2015-08-101-1/+1
|
* locking: teach Clang's -Wthread-safety to cope with our scoped lock macrosCory Fields2015-06-161-4/+4
| | | | | | | | This allows us to use function/variable/class attributes to specify locking requisites, allowing problems to be detected during static analysis. This works perfectly with newer Clang versions (tested with 3.3-3.7). For older versions (tested 3.2), it compiles fine but spews lots of false-positives.
* [Trivial] format sync.hPhilip Kaufmann2015-04-201-14/+9
|
* Removed main.h dependency from rpcserver.cppEric Lombrozo2015-01-281-0/+11
| | | | | | | | Rebased by @laanwj: - update for RPC methods added since 84d13ee: setmocktime, invalidateblock, reconsiderblock. Only the first, setmocktime, required a change, the other two are thread safe.
* Added "Core" to copyright headerssandakersmann2014-12-191-1/+1
| | | | | Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
* Remove references to X11 licenceMichael Ford2014-12-161-1/+1
|
* Apply clang-format on some infrequently-updated filesPieter Wuille2014-09-191-30/+40
|