Added examples for locking variables in multithreading scenarios