wrap the lockings with macros, to easier the later changes if needed

Signed-off-by: Oliver Pinter <oliver.pinter@hardenedbsd.org>