Replace alarm implementation. Use thread.
Replace implementation of alarm(). Use thread