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

Provide a read-write lock #146

Closed
alexdowad opened this issue Aug 9, 2014 · 2 comments
Closed

Provide a read-write lock #146

alexdowad opened this issue Aug 9, 2014 · 2 comments
Assignees
Labels
enhancement Adding features, adding tests, improving documentation.
Milestone

Comments

@alexdowad
Copy link
Contributor

Just discovered this project; it looks like you guys have put together a very nice suite of utilities.

It looks like you don't have a read-write lock yet (one which allows multiple concurrent readers, but only one concurrent writing). A couple years ago, I needed one for a Ruby project and couldn't find anything good, so I developed my own implementation. Here it is: https://github.com/alexdowad/showcase/blob/master/ruby-threads/read_write_lock.rb

I put a fair amount of time into testing and verifying this implementation, and also had a couple of other Ruby developers do code review and test it on their machines as well. It has worked in production for me, without any problems detected. So while more review would be good, it is already somewhat mature.

A RW lock which "spins" when the lock is taken would be lighter (less memory footprint per lock), but is more "dangerous" -- the user needs to know what they are doing when they select such a lock.

If you would like to use this RW lock, please take it and distribute it under your existing license conditions. Of course, I may also use it in other places and distribute it under other licenses.

@jdantonio
Copy link
Member

@alexdowad Thank you for your kind words, and for the offer of your code. I think a read-write lock would be an excellent addition to our toolset. And @chrisseaton will be especially pleased that you included benchmark tests (he's a staunch advocate of performance testing). Would you like to submit this as a PR so that your name gets in the commit log?

@alexdowad
Copy link
Contributor Author

Dear @jdantonio, when I have some time I'll get the code in shape for you
to merge it smoothly and submit a PR.

On Sat, Aug 9, 2014 at 5:34 PM, jdantonio [email protected] wrote:

@alexdowad https://github.com/alexdowad Thank you for your kind words,
and for the offer of your code. I think a read-write lock would be an
excellent addition to our toolset. And @chrisseaton
https://github.com/chrisseaton will be especially pleased that you
included benchmark tests (he's a staunch advocate of performance testing).
Would you like to submit this as a PR so that your name gets in the commit
log?


Reply to this email directly or view it on GitHub
#146 (comment)
.

@jdantonio jdantonio mentioned this issue Aug 9, 2014
@pitr-ch pitr-ch added this to the 0.8.0 Release milestone Aug 10, 2014
@jdantonio jdantonio modified the milestones: 0.9.0 Release, 0.8.0 Release Jan 14, 2015
@jdantonio jdantonio mentioned this issue Mar 1, 2015
34 tasks
@jdantonio jdantonio self-assigned this Mar 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Adding features, adding tests, improving documentation.
Projects
None yet
Development

No branches or pull requests

3 participants