Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: Suspending a process (slighty OT)

by wog (Curate)
on Sep 23, 2001 at 23:00 UTC ( [id://114197]=note: print w/replies, xml ) Need Help??


in reply to Suspending a process (slighty OT)

Typing ctrl-Z at the tty usually just sends the 'TSTP' signal process. You can do this yourself with kill:

kill TSTP => $some_proccess_id;

... you should also be able to catch this signal from a perlscript and do some processing before stopping your process, or just to make your process not be stopable this way. A process can also be stopped with the 'STOP' signal which cannot be caught, which you'd need to use if you wanted to stop your process while still catching the 'TSTP' signal.

Restarting a process can be done by sending the 'CONT' signal to process.

Obviously, you can also do these things using the kill command on the command line.

update: Of course, all this advice is rather UNIX-specific.

Replies are listed 'Best First'.
Re: Re: Suspending a process (slighty OT)
by LD2 (Curate) on Sep 23, 2001 at 23:26 UTC
    From a Windows perspective... just use Win32::Process. $ProcessObj->Suspend(); and  $ProcessObj->Resume(); should do exactly what you wish to do.
      I could be wrong, but I think that the Suspend and Resume methods only work on objects created by Win32::Process::Create().

      Simon Flack ($code or die)
      $,=reverse'"ro_';s,$,\$,;s,$,lc ref sub{},e;$,
      =~y'_"' ';eval"die";print $_,lc substr$@,0,3;
        It will work on anything regardless of how it was created, IF you can obtain a kernel handle to the process with suitable rights. Using the Win32 function to directly create a process is handy because that's what it returns (via the process information structure "out" parameter).

        There is a function, OpenProcess, that will give you a handle from the global "process identifier".

        Having separate handles and ID's is why Win32 doesn't have zombies.

        —John

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://114197]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-19 22:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found