Acquire lock to check for genesis block. #8063

pull pstratem wants to merge 1 commits into bitcoin:master from pstratem:2015-05-16-lockfix changing 1 files +11 −3
  1. pstratem commented at 3:38 AM on May 17, 2016: contributor

    Fix issue identified in #7917 around failure to acquire cs_main for chainActive access.

  2. Acquire lock to check for genesis block. 46b0c3b688
  3. sipa commented at 3:50 AM on May 17, 2016: member

    utACK

    I think it can be written slightly shorter with a reverse lock around the sleep.

  4. pstratem commented at 3:52 AM on May 17, 2016: contributor

    @sipa as in acquire the lock and then release it while sleeping and re-aquire after?

  5. gmaxwell commented at 5:31 AM on May 17, 2016: contributor

    utACK 46b0c3b688dccf6ba9ac08cbd6d6981249a73b1a

    This loses a log entry, but the log entry appears useless...

  6. dcousens commented at 5:42 AM on May 17, 2016: contributor

    utACK 46b0c3b, it'd be nice to use std::condition_variable and wait signals/semaphores for things like this instead of loops and MilliSleep(10);.

  7. kazcw commented at 5:47 AM on May 17, 2016: contributor

    The loop is emulating a condvar here (specifically cvBestBlock), but I don't see a good way to deal with fDisconnect in a cond-wait that isn't quite a bit more involved than fixing this little data race. If init ran in a boost thread it'd be interruptible, but nothing in AppInit2 expects to be exitable via interruption exceptions... utACK 46b0c3b; I'll open a separate bug relating to fDisconnect

  8. jonasschnelli added the label Refactoring on May 17, 2016
  9. pstratem commented at 11:33 PM on May 17, 2016: contributor

    @kazcw agreed this is not ideal... nothing about init.cpp is ideal

  10. TheBlueMatt commented at 2:16 AM on May 18, 2016: member

    utACK 46b0c3b688dccf6ba9ac08cbd6d6981249a73b1a

    On May 16, 2016 8:38:08 PM PDT, Patrick Strateman notifications@github.com wrote:

    Fix issue identified in #7917 around failure to acquire cs_main for chainActive access. You can view, comment on, or merge this pull request online at:

    #8063

    -- Commit Summary --

    • Acquire lock to check for genesis block.

    -- File Changes --

    M src/init.cpp (14)

    -- Patch Links --

    #8063.patch #8063.diff


    You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: #8063

  11. arowser commented at 8:43 AM on May 25, 2016: contributor

    Can one of the admins verify this patch?

  12. sipa merged this on May 25, 2016
  13. sipa closed this on May 25, 2016

  14. sipa referenced this in commit c49c825bd9 on May 25, 2016
  15. codablock referenced this in commit bd363dbbe3 on Sep 16, 2017
  16. codablock referenced this in commit 7f302e66bc on Sep 19, 2017
  17. codablock referenced this in commit 42a3e0d2d7 on Dec 21, 2017
  18. zkbot referenced this in commit 5a626317c7 on Mar 16, 2020
  19. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-19 00:15 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me