* adjust for better logs * if shared lock, still need to wait for exclusive lock to release * fix compilation * fix waiting condition * avoid deleting the entry too early