Semaphore exmaple from TIJ