Skip to content

Simplify CMutexLock#2004

Merged
sipa merged 1 commit intobitcoin:masterfrom
alexanderkjeldaas:simplify-cmutexlock
Nov 24, 2012
Merged

Simplify CMutexLock#2004
sipa merged 1 commit intobitcoin:masterfrom
alexanderkjeldaas:simplify-cmutexlock

Conversation

@alexanderkjeldaas
Copy link
Copy Markdown
Contributor

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.

@sipa
Copy link
Copy Markdown
Member

sipa commented Nov 13, 2012

ACK on the code changes, but one nitpick: can you separate the git commit summary (the first line) and the rest? Some git tools assume everything up to the first empty line is the summary.

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.
@alexanderkjeldaas
Copy link
Copy Markdown
Contributor Author

Done.

@sipa
Copy link
Copy Markdown
Member

sipa commented Nov 18, 2012

ACK

@Diapolo
Copy link
Copy Markdown

Diapolo commented Nov 18, 2012

Compiles just fine on Windows and causes no obvious problems, can't really comment on the changes though.

@BitcoinPullTester
Copy link
Copy Markdown

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/bfc96207998c284e2cb6eb99c99b755a161e723d for binaries and test log.

sipa added a commit that referenced this pull request Nov 24, 2012
@sipa sipa merged commit 3ed1ccb into bitcoin:master Nov 24, 2012
laudney pushed a commit to reddcoin-project/reddcoin-3.10 that referenced this pull request Mar 19, 2014
SmarterHomes pushed a commit to chaincoin/chaincoin that referenced this pull request Apr 6, 2018
There are no watchdogs and it makes no sense to limit triggers by size (invalid triggers are going to be voted down anyway).
512 bytes should be more than enough for any proposal - the only value we do not check size of is URL and with 512 bytes total limit URL has space for almost 300 bytes.
KolbyML pushed a commit to KolbyML/bitcoin that referenced this pull request Dec 5, 2020
… calculation.

75ffadf GUI: Fix shield coins fee calculation. (furszy)

Pull request description:

  With the introduction of the dynamic fee calculation for shielded transaction (bitcoin#1979), the "shield all transparent balance" flow got broken due the different fee requirements.
  In other words, as we are shielding all the available transparent balance, the dynamic fee requirement needs to be known before hand to be subtracted from the total amount that is going to be shielded (otherwise the wallet has no other utxo to add to the transaction to cover the fee).

  So.. this PR fixes it calculating and subtracting the fee from the recipient total amount before create the transaction.

ACKs for top commit:
  random-zebra:
    utACK 75ffadf
  Fuzzbawls:
    utACK 75ffadf

Tree-SHA512: e3f69e24dd26749f246190c06302f631e571c0312ac93acc5a41de3fb7e30e1cdb9349994254f5a071ae3e1becac825b2c74b1e28a0db1a329678d59b90a88fd
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants