This class implements typical Reader-Writer lock. The Reader-Writer lock is used in the situation which meets the following conditions:
- Protect some shared object
- The object accepts both of read and write accesses.
- No readers are accepted during a writer is working.
- If there is no writer, several readers can be accepted at a time.
You can use this class as auto variable like the following code: