Sam Dela Cruz wrote: > > Hi all, > > I just need to find out when a process would terminate before I continue > with my program. > > Here's the situation. When I start my program, it looks to see if a > certain process is running. If it is, then I would like my program to > wait till that process is terminated before continuing. Had anyone of > you done this before? > > I'm thinking of getting the process id then monitor if the process id > no longer exists by polling the process list again and again. But I'm > thinking that this may not be the proper way of doing it. Is there a > way to monitor if a process is terminating based on just he process id?
If you are in control of both processes, you could use a pidfile and check if it's there and has a pid in it and if that pid is running. If it's not there, start the task. If it's there, but the pid isn't running, remove the pidfile. You could also use a semaphore or mutex. If you don't have control of the other process, look at Win32::GUI/GuiTest to use for finding an active process and maybe Win32::Process to create a new own and control it. -- ,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED] (_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED] / ) /--< o // // Castle of Medieval Myth & Magic http://www.todbe.com/ -/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff) _______________________________________________ ActivePerl mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
