Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename SharedMutex and introduce Mutex #132

Merged
merged 2 commits into from
Jul 8, 2024
Merged

Conversation

jac3km4
Copy link
Contributor

@jac3km4 jac3km4 commented Jul 7, 2024

I was looking into the RTTI and there appear to be 4 types of locks:

  • spin lock (currently named SpinLock in the SDK)
  • shared spin lock (currently named SharedMutex in the SDK)
  • mutex (uses critical section, does not exist in the SDK)
  • shared mutex (uses srwlock, does not exist in the SDK)

In this PR I do a little bit of cleanup:

  • rename SharedMutex to SharedSpinLock, because that's the more appopriate name, in c++ a shared mutex corresponds to a srwlock on Windows, not a spin lock
  • introduce Mutex
  • update the RTTI system to make use of Mutex and SharedSpinLock

I didn't add the rwlock because I don't think it's needed anywhere in the SDK right now.

psiberx
psiberx previously approved these changes Jul 7, 2024
Copy link
Owner

@wopss wopss left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! I added my comments.

include/RED4ext/Mutex.hpp Outdated Show resolved Hide resolved
include/RED4ext/SharedSpinLock.hpp Show resolved Hide resolved
@wopss wopss merged commit f172089 into wopss:master Jul 8, 2024
9 checks passed
@jac3km4 jac3km4 deleted the mutex-spin-lock branch July 8, 2024 10:13
@jac3km4 jac3km4 restored the mutex-spin-lock branch July 8, 2024 10:13
@jac3km4 jac3km4 deleted the mutex-spin-lock branch July 8, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants