aboutsummaryrefslogtreecommitdiff
path: root/src/sync.h
AgeCommit message (Collapse)Author
2017-08-07scripted-diff: Use the C++11 keyword nullptr to denote the pointer literal ↵practicalswift
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-
2017-06-09Remove unused Boost includespracticalswift
2017-03-17Remove unused codepracticalswift
2017-01-05Break addnode out from the outbound connection limits.Gregory Maxwell
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.
2016-12-31Increment MIT Licence copyright header year on files modified in 2016isle2983
Edited via: $ contrib/devtools/copyright_header.py update .
2016-08-06Do not shadow LOCK's criticalblock variable for LOCK inside LOCKPavel Janík
2016-04-10Clean up lockorder data of destroyed mutexesPieter Wuille
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.
2015-12-13Bump copyright headers to 2015MarcoFalke
2015-08-10typofixes (found by misspell_fixer)Veres Lajos
2015-06-16locking: teach Clang's -Wthread-safety to cope with our scoped lock macrosCory Fields
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.
2015-04-20[Trivial] format sync.hPhilip Kaufmann
2015-01-28Removed main.h dependency from rpcserver.cppEric Lombrozo
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.
2014-12-19Added "Core" to copyright headerssandakersmann
Github-Pull: #5494 Rebased-From: 15de949bb9277e442302bdd8dee299a8d6deee60
2014-12-16Remove references to X11 licenceMichael Ford
2014-09-19Apply clang-format on some infrequently-updated filesPieter Wuille
2014-08-28add missing header end commentsPhilip Kaufmann
- ensures a consistent usage in header files - also add a blank line after the copyright header where missing - also remove orphan new-lines at the end of some files
2014-07-11getblocktemplate: longpolling supportLuke Dashjr
2013-12-19Use mutex pointer instead of name for AssertLockHeldWladimir J. van der Laan
This makes it useable for non-global locks such as the wallet and keystore locks.
2013-11-29mutex debugging routines: LocksHeld() and AssertLockHeld()Gavin Andresen
2013-11-10Cleanup code using forward declarations.Brandon Dahler
Use misc methods of avoiding unnecesary header includes. Replace int typedefs with int##_t from stdint.h. Replace PRI64[xdu] with PRI[xdu]64 from inttypes.h. Normalize QT_VERSION ifs where possible. Resolve some indirect dependencies as direct ones. Remove extern declarations from .cpp files.
2013-10-20Bump Year Number to 2013super3
2013-06-25Added comments to sync.h to make it easier to understand the macrosEric Lombrozo
2012-12-12Merge pull request #2003 from alexanderkjeldaas/documented-locking-part-2Gavin Andresen
Documented locking part 1+2
2012-11-14Simplify CMutexLockAlexander Kjeldaas
o Remove unused Leave and GetLock functions o Make Enter and TryEnter private. o Simplify Enter and TryEnter. boost::unique_lock doesn't really know whether the mutex it wraps is locked or not when the defer_lock option is used. The boost::recursive_mutex does not expose this information, so unique_lock only infers this knowledge. When taking the lock is defered, it (randomly) assumes that the lock is not taken. boost::unique_lock has the following definition: unique_lock(Mutex& m_,defer_lock_t): m(&m_),is_locked(false) {} bool owns_lock() const { return is_locked; } Thus it is a mistake to check owns_lock() in Enter and TryEnter - they will always return false.
2012-11-11o Added AnnotatedMixin which adds locking annotations to the mutexAlexander Kjeldaas
API, compatible with clang's -Wthread-safety
2012-09-25Update comment, we're no longer using boost::interprocess::scoped_lockWladimir J. van der Laan
2012-06-05Fix DEBUG_LOCKCONTENTIONMatt Corallo
2012-05-20Merge pull request #1354 from fanquake/masterPieter Wuille
Update Header Licenses
2012-05-18Use boost::thread locking instead of interprocessPieter Wuille
2012-05-18Update License in File HeadersFordy
I originally created a pull to replace the "COPYING" in crypter.cpp and crypter.h, but it turned out that COPYING was actually the correct file.
2012-05-11Split synchronization mechanisms from util.{h,cpp}Pieter Wuille