changed from poll to pthread_signal