make locking function compiler dependent