Simpler optional locking
Merge remote-tracking branch 'upstream/master' into envlock

Conflicts:
	src/util/lock.h