Skip to content

Perf: Implement RAII for Mutex in RandomCIDFactory#48988

Open
athy125 wants to merge 1 commit intonodejs:mainfrom
athy125:patch-1
Open

Perf: Implement RAII for Mutex in RandomCIDFactory#48988
athy125 wants to merge 1 commit intonodejs:mainfrom
athy125:patch-1

Conversation

@athy125
Copy link

@athy125 athy125 commented Aug 1, 2023

Used RAII to manage the mutex in the RandomCIDFactory class. Replaced manual locking and unlocking with std::lock_guard for automatic locking and unlocking of the mutex within the critical sections of code

Used RAII to manage the mutex in the RandomCIDFactory class. Replaced manual locking and unlocking with std::lock_guard for automatic locking and unlocking of the mutex within the critical sections of code
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. quic Issues and PRs related to the QUIC implementation / HTTP/3. labels Aug 1, 2023
@bnoordhuis
Copy link
Member

bnoordhuis commented Aug 2, 2023

Misleading description: we're already using RAII, just not std::lock_guard

Technical: I strongly doubt this compiles because node::Mutex doesn't implement .lock() and .unlock()

Philosophical: either replace Mutex and ScopedLock wholesale across the code base with their std:: counterparts, or don't, but no halfsies

@athy125
Copy link
Author

athy125 commented Aug 2, 2023

Understood, so basically if we're going to replace Mutex and ScopedLock with their std::counterparts, we'll need to make changes consistently throughout the code, yes?
For example Replace ScopedLock with std::unique_lock so on and so forth?

@bnoordhuis
Copy link
Member

Yes, exactly.

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

Labels

c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. quic Issues and PRs related to the QUIC implementation / HTTP/3.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants