Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!lavaca.uh.edu!uhnix1!csuna.cs.uh.edu!rr From: rr@csuna.cs.uh.edu (Ravi Ramachandran) Newsgroups: comp.unix.wizards Subject: Setting multiple timers from a single process. Message-ID: <24200@uhnix1.uh.edu> Date: 14 Mar 90 05:41:31 GMT Sender: nntppost@uhnix1.uh.edu Reply-To: rr@cs.uh.edu Organization: University of Houston Lines: 20 The subj line says it; I want to set multiple timers from a single process. Using alarm() & catching SIGALARM will permit only a single timer. I need to set different values for the different timers concurrently, and need the ability to restart them or to cancel them. My solution at the moment; each time I need a timer (a max of 4 will be needed concurrently), I spawn a child and store the pid returned to uniquely identify thst timer. The child does a sleep(time) for the required time. After which SIGCLD goes off. In my interrupt routine of my main process, I track down which child expired and determine which timer expired. Dirty, and difficult to manage, but still workable. As they said when tearing down the Berlin Wall, "Open to better suggestions." --ravi-