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

Re^2: Windows process suspend

by gautamparimoo (Beadle)
on Apr 24, 2013 at 09:28 UTC ( #1030318=note: print w/replies, xml ) Need Help??

in reply to Re: Windows process suspend
in thread Windows process suspend

the documentation has given this line:

Suspend(@Handles); or Suspend($Handle);

So what am I exactly doing wrong?

One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. -Elbert Hubbard

Replies are listed 'Best First'.
Re^3: Windows process suspend
by roboticus (Chancellor) on Apr 24, 2013 at 10:09 UTC


    You want to kill specific processes. Each process ID is a number referring to a job. So you need to determine which process number you want to kill. It looks like you have things in hand to that point. But when you get the handles for the threads, you've got a bug. Since GetHandles returns a *list* of handles, you'll need to do something like:

    use strict; use warnings; use Win32::Process::Kill; my $pids = $ARGV[0]; # Get *all* the handles returned my @handles = GetHandle($pids); print scalar(@handles), " handles returned\n"; # We'll just suspend the first one: my $handle = $handles[0]; SuspendProcess($handle);

    Note: I'm on a linux box right now, so I can't test things out at the moment, but after reviewing the docs, that's what I'm expecting.


    When your only tool is a hammer, all problems look like your thumb.

      I think the problem is with use Win32::Process::Kill; as if i print anything after it that does not get printed and it crashes.Secondly in the documents its shown as:

      @Handles = GetHandle(@pids); or ($handle) = GetHandle($pid);

      So I cannot make out the problem. If anybody on Windows please explain?

      One machine can do the work of fifty ordinary men. No machine can do the work of one extraordinary man. -Elbert Hubbard

        Are you saying you will get a crash if you just do this:

        use Win32::Process::Kill; print "I am OK\n";


        Pereant, qui ante nos nostra dixerunt!

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1030318]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (3)
As of 2018-03-19 06:02 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (232 votes). Check out past polls.