Waits for a resource lock to become available. This function blocks,
repeatedly checking if the specified lock has been released.
Parameters:
name - the name of the lock to check.
delay - the maximum time to wait in seconds.
Returns:
One of the LKR_x result codes representing the state of the
lock when the process exist. LKR_TIMEOUT is reported when the time
specified by delay expired and the lock was still unavailable.