Refactor: functions_locking.sh as independent module

Change-Id: I4b5fb4c2a1b33d67f8656a6c472d8fcc7603c817