Wait for lock

Change-Id: I4a776792ffb815876ec243c7c2bac4d155a7c07e
Fix all build errors

Change-Id: Ie32d98b5b573d6625a69d604aa2f50a83fc3514c