Skip to content

Provide a read-write lock #146

Closed
Closed
@alexdowad

Description

@alexdowad

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.

Metadata

Metadata

Assignees

Labels

enhancementAdding features, adding tests, improving documentation.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions