added example with lock conditions for synchronizing threads.