Lock mt variable for read protection. Several concurrent programs can read lock a variable, but so long as long there are read locks no program can write lock a variable.
The function will wait until it can lock the variable. A variable can not be read locked if the variable is write locked or there is a write lock waiting for the variable.