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

lock: clear the in-memory lock flag if we failed to acquire a flock. #8

Closed
wants to merge 1 commit into from

Conversation

yifan-gu
Copy link

As @bradfitz mentioned in camlistore/lock#12 (comment) , the package is moved here, but from the code, it seems the behavior is still the same here.

This PR clears the in-memory map entry when the locking action fails. It also wraps the mutex and map into a struct for cleanness.

Also added a test to verify that a second Lock() can still succeed if the first one fails.

@yifan-gu
Copy link
Author

Sorry, didn't see https://github.com/camlistore/go4/pull/7/files when I filed the PR. Feel free to close if it's duplicated

Also add a test to verify that a second Lock() will succeed after
the first one fails.
@mpl
Copy link
Contributor

mpl commented Jan 25, 2016

yes, this looks like the same as https://review.gerrithub.io/260449
I'll double-check before closing, after rog's PR gets in.

@yifan-gu
Copy link
Author

@mpl Thank you

@yifan-gu
Copy link
Author

Close as #7 is merged.

@yifan-gu yifan-gu closed this Jan 26, 2016
@yifan-gu yifan-gu deleted the clear_lock branch January 26, 2016 01:21
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.

None yet

2 participants