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

Add timeout versions for LightLock, RecursiveLock, and LightSemaphore #523

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

piepie62
Copy link
Contributor

@piepie62 piepie62 commented May 2, 2023

No description provided.

@fincs
Copy link
Member

fincs commented May 5, 2023

I'm curious as to which use case prompted this PR.

@xzn
Copy link

xzn commented Jan 7, 2024

Some questions:

I have a slightly different implementation a while back: source

It doesn't yet have decreasing timeout on looped arbitrate attempts, which I tried to remedy in this version (from branch)

There are some other differences though:

  • I used ARBITRATION_WAIT_IF_LESS_THAN_TIMEOUT instead of ARBITRATION_WAIT_IF_LESS_THAN, not sure if it matters.
  • On timeout or error, for LightLock, the waiting thread count is released by 1 before returning: source, I don't see similar code in your PR.
  • Similarly for LightSemaphore, the number of threads acquiring the lock is released by 1 before returning: source. Again In your PR the status is returned before doing the associated adjustment.

So the question:

Are those adjustment unnecessary (or incorrect) in my version? I do use the code in a homebrew and it works afaict..

@fincs

As for use case, I just wanted something that matches the behavior of svcWaitSynchronization as I have macro to switch between either svc sync or libctru sync for testing purpose.

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