scripted-diff: Small locking rename #11599

pull ryanofsky wants to merge 1 commits into bitcoin:master from ryanofsky:pr/locksren changing 10 files +22 −25
  1. ryanofsky commented at 12:11 PM on November 3, 2017: contributor

    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's 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.

  2. ryanofsky cross-referenced this on Nov 3, 2017 from issue Fix -Wthread-safety-analysis warnings. Compile with -Wthread-safety-analysis if available. by practicalswift
  3. promag commented at 2:10 PM on November 3, 2017: member

    Concept ACK.

    Drop C prefix too?

  4. ryanofsky commented at 2:56 PM on November 3, 2017: contributor

    Concept ACK.

    Drop C prefix too?

    Thanks, will wait for more feedback. I didn't rename CCriticalSection because it's used everywhere and changing it would make the diff 3 times as big (22 lines -> 73 lines). Also I think we will probably lean toward using non-recursive rather than recursive locks in new code, so CCriticalSection name should not matter as much going forward. I kept the C in CCriticalLock to be consistent with CCriticalSection. CCriticalLock is only used internally in sync.h so again it shouldn't have an impact on new code, and I didn't see a reason to break consistency within sync.h.

  5. practicalswift commented at 3:48 PM on November 3, 2017: contributor

    utACK eec3e2261eb895b704c5153203e6b1b946213667

  6. TheBlueMatt commented at 9:21 PM on November 3, 2017: contributor

    To me, calling it just "Mutex"/"Lock" implies this is what people should use for new mutexs/locks, but that isn't what we want because it doesn't support DEBUG_LOCKORDER. Indeed, we maybe could make it support DEBUG_LOCKORDER and then start migrating to it over our current recursive stuff, but for now I'd prefer to make it more clear that the new typedefs should be discouraged.

  7. ryanofsky commented at 9:29 PM on November 3, 2017: contributor

    Is DEBUG_LOCKORDER the only reason you want to discourage these?

  8. TheBlueMatt commented at 9:35 PM on November 3, 2017: contributor

    I suppose, I mean as long as its clear that its non-recursive and someone doesn't introduce a bug on accident cause they're not paying attention, DEBUG_LOCKORDER would be my only complaint.

  9. ryanofsky commented at 9:35 PM on November 3, 2017: contributor

    I'll just implement DEBUG_LOCKORDER for these. It should be pretty easy.

  10. fanquake added the label Refactoring on Nov 4, 2017
  11. laanwj commented at 7:16 PM on November 9, 2017: member

    If we're renaming them anyway, why not call them what they are? RecursiveMutex. RecursiveLock, Mutex, Lock?

    Do we need any special, project-local names for locking constructs at all or could we do with simply the c++11 naming? (I've wondered about this many times)

    I'm all for using non-recursive locks in new code, using recursive locks is usually discouraged nowadays.

  12. TheBlueMatt commented at 7:38 PM on November 9, 2017: contributor

    Indeed, after #11640, and because this is scripted, I'd be more than happy to see us drop the "CriticalSection" naming - no one uses that anymore...

  13. practicalswift commented at 10:01 AM on November 10, 2017: contributor

    Agree with @laanwj – let's use the standard C++11 naming instead of project-local names for the locking constructs.

    Are there any good arguments for continuing with project-local names for the locking constructs?

  14. ryanofsky force-pushed on Nov 27, 2017
  15. ryanofsky force-pushed on Dec 12, 2017
  16. ryanofsky cross-referenced this on Feb 8, 2018 from issue Make CWallet::ListCoins atomic by promag
  17. ryanofsky force-pushed on Feb 8, 2018
  18. ryanofsky force-pushed on Apr 10, 2018
  19. ryanofsky force-pushed on Apr 13, 2018
  20. ryanofsky force-pushed on Apr 26, 2018
  21. ryanofsky cross-referenced this on May 8, 2018 from issue Refactor: separate wallet from node by ryanofsky
  22. DrahtBot cross-referenced this on Jun 19, 2018 from issue [net] Thread safety annotations in net_processing by skeees
  23. DrahtBot commented at 11:51 PM on July 22, 2018: contributor

    <!--5d09a71f8925f3f132321140b44b946d-->The last travis run for this pull request was 87 days ago and is thus outdated. To trigger a fresh travis build, this pull request should be closed and re-opened.

  24. DrahtBot closed this on Jul 22, 2018

  25. DrahtBot reopened this on Jul 22, 2018

  26. DrahtBot added the label Needs rebase on Jul 26, 2018
  27. ryanofsky force-pushed on Aug 6, 2018
  28. DrahtBot removed the label Needs rebase on Aug 6, 2018
  29. DrahtBot cross-referenced this on Aug 10, 2018 from issue Track best-possible-headers (TheBlueMatt) by Sjors
  30. DrahtBot cross-referenced this on Aug 11, 2018 from issue refactor: Removal of circular dependency between index/txindex, validation and index/base by mgrychow
  31. laanwj commented at 10:40 AM on August 31, 2018: member

    Please get rid of the "Merge remote-tracking branch 'origin/pull/11640/head'" merge commit

    utACK otherwise

  32. ryanofsky commented at 11:44 AM on August 31, 2018: contributor

    Please get rid of the "Merge remote-tracking branch 'origin/pull/11640/head'" merge commit

    utACK otherwise @laanwj, could you add your utACK to #11640? The merge just indicates #11599 is based on #11640, and distinguishes the #11599 commits from the #11640 one.

  33. scripted-diff: Small locking rename
    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-
    190bf62be1
  34. MarcoFalke added the label Needs rebase on Aug 31, 2018
  35. MarcoFalke commented at 2:19 PM on August 31, 2018: member

    Needs rebase

  36. ryanofsky force-pushed on Aug 31, 2018
  37. ryanofsky commented at 2:20 PM on August 31, 2018: contributor

    Needs rebase

    Rebased f21c529c0b77f745f5ae2fd999b268d0d49f68a8 -> 190bf62be1214b072513c7fd7e01cc191723967c (pr/locksren.8 -> pr/locksren.9) after #11599 merge.

  38. laanwj commented at 3:24 PM on August 31, 2018: member

    utACK 190bf62be1214b072513c7fd7e01cc191723967c

  39. laanwj merged this on Aug 31, 2018
  40. laanwj closed this on Aug 31, 2018

  41. laanwj referenced this in commit 59ecacfc84 on Aug 31, 2018
  42. Bushstar cross-referenced this on Sep 4, 2018 from issue commits from bitcoin/master by Bushstar
  43. laanwj removed the label Needs rebase on Oct 24, 2019
  44. str4d cross-referenced this on Apr 12, 2021 from issue Sync backports by str4d
  45. kwvg referenced this in commit f7567ee9d1 on Jun 5, 2021
  46. kwvg referenced this in commit 944aea8753 on Jun 6, 2021
  47. UdjinM6 referenced this in commit 42aa802a3c on Jun 6, 2021
  48. UdjinM6 referenced this in commit a8aee57447 on Jun 11, 2021
  49. bitcoin locked this on Dec 16, 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-05-19 06:54 UTC