Theoretically this should work to use less 'CPU'; or more.
#define NORMAL_PRIORITY_CLASS 0x00000020 #define IDLE_PRIORITY_CLASS 0x00000040 #define HIGH_PRIORITY_CLASS 0x00000080 #define REALTIME_PRIORITY_CLASS 0x00000100 # Win2000 #define BELOW_NORMAL_PRIORITY_CLASS 0x00004000 #define ABOVE_NORMAL_PRIORITY_CLASS 0x00008000
BEGIN { use Win32::API; Win32::API::->Import("kernel32","HANDLE GetCurrentProcess()"); Win32::API::->Import("kernel32","BOOL SetPriorityClass(HANDLE hPro +cess, DWORD dwPriorityClass)"); SetPriorityClass(GetCurrentProcess(),0x00004000); }

Replies are listed 'Best First'.
Re: use less 'CPU';
by Anonymous Monk on Mar 22, 2004 at 17:56 UTC
    *nix version
    use POSIX qw(nice); nice(10);
    ;)
Re: use less 'CPU';
by hardburn (Abbot) on Mar 22, 2004 at 15:03 UTC

    Isn't that nice.

    ----
    : () { :|:& };:

    Note: All code is untested, unless otherwise stated

Re: use less 'CPU';
by flyingmoose (Priest) on Mar 22, 2004 at 18:26 UTC
    I thought Windows by default used more CPU.

    *rimshot*

      Yeah, and that means there's less CPU available for the Perl program. ;-)

      Abigail

Re: use less 'CPU';
by eserte (Deacon) on Mar 22, 2004 at 15:37 UTC
    This was not the intension of "use less". It's more to have the ability to switch between algorithms/representations which differ in CPU and memory consumption. For example: substr in unicode-strings is relatively CPU-inefficient and memory-efficient if the utf-8 encoding is used, but CPU-efficient and memory-inefficient if using ucs-4.
      When has anyone ever needed to use substr on a unicode string?