Adding semaphore and threading example