I've discovered that the exported values for the various THREAD_PRIORITY_ disagree with the values my C acquaintance gave me. The values exported by Win32::Process are :
THREAD_PRIORITY_HIGHEST -1 THREAD_PRIORITY_ABOVE_NORMAL null THREAD_PRIORITY_NORMAL -2 THREAD_PRIORITY_BELOW_NORMAL 1 THREAD_PRIORITY_IDLE 2147483647 THREAD_PRIORITY_LOWEST -15
The values my C acquaintance gave me are :-
Description Process priority Thread Priority Realtime 256 15 High 128 2 Above normal 32768 1 Normal 32 0 Below normal 16384 -1 Idle 64 -2 Lowest n/a -15
I use the following code :-
$returncode=Win32::Process::Open($obj,$pid,0); print "\n $returncode \n"; $returncode=$obj->SetPriorityClass(THREAD_PRIORITY_LOWEST); print "\n $returncode \n";
It returns code 0 (failure) for HIGHEST and NORMAL, 1 (OK) for BELOW, IDLE, LOWEST, but does not in fact set the Thread Priority. In fact it will only set Process Priority, and only when I give it correct values as detailed above. E.g.
$returncode=$obj->SetPriorityClass(32);
sets Process Priority to normal as it should. Conclusion : SetPriority does not seem able to set Thread Priority. Or am I missing something ? How do I tell it that it's a Thread Priority I'm trying to change rather than a Process Priority ? Why would the Pod text describe Thread Priority values if the routine won't use them ?

In reply to Re^4: how to change process & thread priority on Win32 ? by rbutcher
in thread how to change process & thread priority on Win32 ? by rbutcher

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.