keyvalued: add locking to examples