used rwlock as a start of a generic locking module

Signed-off-by: Jan Dvořák <mordae@anilinux.org>