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: member

    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. promag commented at 2:10 pm on November 3, 2017: member

    Concept ACK.

    Drop C prefix too?

  3. ryanofsky commented at 2:56 pm on November 3, 2017: member

    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.

  4. practicalswift commented at 3:48 pm on November 3, 2017: contributor
    utACK eec3e2261eb895b704c5153203e6b1b946213667
  5. TheBlueMatt commented at 9:21 pm on November 3, 2017: member
    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.
  6. ryanofsky commented at 9:29 pm on November 3, 2017: member
    Is DEBUG_LOCKORDER the only reason you want to discourage these?
  7. TheBlueMatt commented at 9:35 pm on November 3, 2017: member
    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.
  8. ryanofsky commented at 9:35 pm on November 3, 2017: member
    I’ll just implement DEBUG_LOCKORDER for these. It should be pretty easy.
  9. fanquake added the label Refactoring on Nov 4, 2017
  10. 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.

  11. TheBlueMatt commented at 7:38 pm on November 9, 2017: member
    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…
  12. 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?

  13. ryanofsky force-pushed on Nov 27, 2017
  14. ryanofsky force-pushed on Dec 12, 2017
  15. ryanofsky force-pushed on Feb 8, 2018
  16. ryanofsky force-pushed on Apr 10, 2018
  17. ryanofsky force-pushed on Apr 13, 2018
  18. ryanofsky force-pushed on Apr 26, 2018
  19. DrahtBot commented at 11:51 pm on July 22, 2018: member
  20. DrahtBot closed this on Jul 22, 2018

  21. DrahtBot reopened this on Jul 22, 2018

  22. DrahtBot added the label Needs rebase on Jul 26, 2018
  23. ryanofsky force-pushed on Aug 6, 2018
  24. DrahtBot removed the label Needs rebase on Aug 6, 2018
  25. 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

  26. ryanofsky commented at 11:44 am on August 31, 2018: member

    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.

  27. 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
  28. MarcoFalke added the label Needs rebase on Aug 31, 2018
  29. MarcoFalke commented at 2:19 pm on August 31, 2018: member
    Needs rebase
  30. ryanofsky force-pushed on Aug 31, 2018
  31. ryanofsky commented at 2:20 pm on August 31, 2018: member

    Needs rebase

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

  32. laanwj commented at 3:24 pm on August 31, 2018: member
    utACK 190bf62be1214b072513c7fd7e01cc191723967c
  33. laanwj merged this on Aug 31, 2018
  34. laanwj closed this on Aug 31, 2018

  35. laanwj referenced this in commit 59ecacfc84 on Aug 31, 2018
  36. laanwj removed the label Needs rebase on Oct 24, 2019
  37. kittywhiskers referenced this in commit f7567ee9d1 on Jun 5, 2021
  38. kittywhiskers referenced this in commit 944aea8753 on Jun 6, 2021
  39. UdjinM6 referenced this in commit 42aa802a3c on Jun 6, 2021
  40. UdjinM6 referenced this in commit a8aee57447 on Jun 11, 2021
  41. MarcoFalke 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: 2024-07-03 10:13 UTC

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