Path: utzoo!attcan!uunet!cme!libes From: libes@cme.nist.gov (Don Libes) Newsgroups: comp.unix.wizards Subject: Re: Setting multiple timers from a single process. Message-ID: <3412@muffin.cme.nist.gov> Date: 14 Mar 90 20:43:36 GMT References: <24200@uhnix1.uh.edu> Reply-To: libes@cme.nist.gov (Don Libes) Organization: National Institute of Standards and Technology Lines: 18 In article <24200@uhnix1.uh.edu> rr@cs.uh.edu writes: >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 > >My solution at the moment; [spawn child processes for each timer] Simulate them by waiting for the shortest one, and keeping track of the others yourself. I've done exactly this. Anyone who wants code (4.2BSD) can mail me. Just watch out for things like 1) a timer interrupting your timer management code, 2) trying to cancel one this is in the process of going off (or will be by the time you return), 3) getting a new timer which is shorter than the current one you are waiting for, and 4) the possibility of several being scheduled for the same time. Don Libes libes@cme.nist.gov ...!uunet!cme-durer!libes