Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

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


Comment on Re^2: Windows process suspend
Download Code
Re^3: Windows process suspend
by roboticus (Canon) on Apr 24, 2013 at 10:09 UTC

    gautamparimoo:

    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.

    ...roboticus

    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";

        Cheers,
        R.

        Pereant, qui ante nos nostra dixerunt!

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (5)
As of 2014-09-17 01:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (56 votes), past polls