-
Notifications
You must be signed in to change notification settings - Fork 3k
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
threads: remove unused recursive mutex support #15995
base: master
Are you sure you want to change the base?
Conversation
Download the artifacts for this pull request: |
Shouldn't win32 recursive mutex be removed completely instead of ifdef? I don't think vdpau is supported on win32. |
The idea is if in the feature anyone wants to use it the code is there. When I added it initially there was more users of recursive mutex. I also don't like those ifdefs, but not having feature parity between wrappers would be awkward. |
It doesn't simplify the code when the recursive mutex isn't removed but instead adding more ifdefs on top of it. At best it saves a few bytes for the mutex struct. If you want to keep the recursive mutex implementation for future use, I don't think the ifdefs worth it, because if it is added in a mandatory part of mpv, then the recursive mutex becomes mandatory anyway so ifdefs aren't needed. |
I'd rather just remove vdpau than this tbh. Not that I'm suggesting we need to. |
Simplification is not the main objective of this PR.
It saves 40 bytes from
That's a big "if". I would rather avoid recursive mutexes at all cost.
Maybe I should read the code if this mutex is needed there. |
There is no need to put ifdef everywhere if this is what you wanted. Replace |
I will remove recursive mutex completely after #15997 is merged. EDIT: Updated this PR too. |
And eliminate recursive lock. This doesn't have to be guarded by mutex, if for some reason preemption happens while we are handling preemption, we remember the flag and do the dance gain. This is even nicer than locking preemption callback.
After removal of `MP_MUTEX_RECURSIVE` from vdpau.c there are no more clients of recursive mutex. Remove all the code related to it. This commit can be reverted if in the future it is needed again. For now let's not keep dead code.
39cd8ad
to
938b359
Compare
The only use of
MP_MUTEX_RECURSIVE
is in vdpau.c. If it is disabled, remove the unused code. This simplifies the win32 implementation by eliminating unnecessary critical section references.