I have some data structure, in which I want to exclusively lock the access for writing, but to enable parallel access for reading.
I made some searches and found out the classes ReadWriteLock
and ReentrantReadWriteLock
- which both supply a read-lock and a write-lock.
I didn't understand what is the difference between them. Could someone please explain?
I am feeling stupid for my question - the answer is very simple... I hope I'll save time to other people though..
ReadWriteLock
is simply an interface, while ReentrantReadWriteLock
is an implementation of it..
So you can't actually use "an instance of ReadWriteLock
"...
That's the whole answer...