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

Semaphore #34

Open
satunin opened this issue May 7, 2021 · 1 comment
Open

Semaphore #34

satunin opened this issue May 7, 2021 · 1 comment

Comments

@satunin
Copy link

satunin commented May 7, 2021

Hi. Can i use this library like a semaphore. For example Acquire() can return SharedHoldersCount, not only LockHandle

@distorhead
Copy link
Member

I think it is currently not possible to make shared holders count available publicly in the LockHandle (or as a separate return value), because this counter could change in any moment leaving a user of LockHandle with incorrect count number. Semaphore support should be added directly into the core of the library.

Semaphore could be implemented using mutex though. But it is up to you to make counter shared between multiple processes using some storage.

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

No branches or pull requests

2 participants