added example of synchronization throughe explicit use of locks
added example with lock conditions for synchronizing threads.