Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: Set thread quantum for process under Windows

by chessgui (Scribe)
on Jan 05, 2012 at 10:19 UTC ( [id://946351]=note: print w/replies, xml ) Need Help??


in reply to Re: Set thread quantum for process under Windows
in thread Set thread quantum for process under Windows

Thanks a lot. These seem to be useful starting points. But my main goal is to do this on a constant basis (ie. not having to look my process up in the table manually every time rather do it automatically from the script) and having a look at the Win32::Process module it seems to me that if I open the process that way I won't have handles to the STDIN and STDOUT of the process, while if I open it through Open2 (as I do currently) there is not a Win32::Process object on which I can perform $ProcessObj->SetPriorityClass($class). There seems to be no method for creating a Win32::Process object from a pid.
  • Comment on Re^2: Set thread quantum for process under Windows

Replies are listed 'Best First'.
Re^3: Set thread quantum for process under Windows
by BrowserUk (Patriarch) on Jan 05, 2012 at 10:35 UTC
    There seems to be no method for creating a Win32::Process object from a pid.

    Actually there is:

    Win32::Process::Open( $obj, $pid, $iflags );

    $pid is an existingprocess id as return by open2(), $obj is a variable you pass in which gets set to a Win32::Process object handle. You can the call ->SetPriority() on that. Eg.

    use Win32::Process;; $pid = system 1, 'notepad';; ## The return from open2 should work just + as well. Win32::Process::Open( $o, $pid, 0 );; print $o;; Win32::Process=SCALAR(0x4073208) $o->SetPriorityClass( IDLE_PRIORITY_CLASS );;

    With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

    The start of some sanity?

      How could I have missed this?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (2)
As of 2024-04-26 06:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found