using semaphore to inform udp thread