Skip to content

Use of raw RWLock instead of RwLock #60576

Closed

Description

@hellow554

static HOOK_LOCK: RWLock = RWLock::new();
static mut HOOK: Hook = Hook::Default;

looking at these two lines of code is very frightening.
Is there a specific reason to use RWLock instead of RwLock? I would open a PR with either using RwLock or a comment describing why RWLock is needed here.

@rustbot modify labels: T-libs

Activity

  1. added
    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.
    T-libs-api[DEPRECATED; DO NOT USE]
    on May 6, 2019
  2. Lonami commented on May 6, 2019

    @Lonami
    Contributor

    Just another thought, isn't the naming itself a bit dangerous? RW vs. Rw seems like an easy typo to make. Perhaps renaming RW as RawRw could help?

  3. sfackler commented on May 6, 2019

    @sfackler
    Member

    RwLock can't be statically initialized, or at least couldn't be when that code was written. That'll change once the parking_lot PR lands.

  4. hellow554 commented on May 25, 2021

    @hellow554
    ContributorAuthor

    Hey @sfackler
    has the parking_lot PR already landed? Can you maybe tell the PR number? I would like to give it a shot to clean this up.

  5. mati865 commented on May 25, 2021

    @mati865
    Member

    It was not merged: #56410 (comment)

  6. hellow554 commented on May 25, 2021

    @hellow554
    ContributorAuthor

    I will close this issue as I don't see that this can and will be addressed any time soon. Thank you for your answer mati :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-cleanupCategory: PRs that clean code up or issues documenting cleanup.T-libs-api[DEPRECATED; DO NOT USE]

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions