implement priorities on windows

db4
Doug Coleman 2008-03-26 15:55:55 -05:00
parent 0f6a5f33ce
commit 65a12660a7
4 changed files with 14 additions and 1 deletions

View File

@ -38,6 +38,7 @@ SYMBOL: +low-priority+
SYMBOL: +normal-priority+
SYMBOL: +high-priority+
SYMBOL: +highest-priority+
SYMBOL: +realtime-priority+
: <process> ( -- process )
process construct-empty

View File

@ -24,6 +24,7 @@ USE: unix
{ +normal-priority+ 0 }
{ +high-priority+ -10 }
{ +highest-priority+ -20 }
{ +realtime-priority+ -20 }
} at set-priority
] when* ;

View File

@ -49,6 +49,17 @@ TUPLE: CreateProcess-args
: join-arguments ( args -- cmd-line )
[ escape-argument ] map " " join ;
: lookup-priority ( process -- n )
priority>> {
{ +lowest-priority+ [ IDLE_PRIORITY_CLASS ] }
{ +low-priority+ [ BELOW_NORMAL_PRIORITY_CLASS ] }
{ +normal-priority+ [ NORMAL_PRIORITY_CLASS ] }
{ +high-priority+ [ ABOVE_NORMAL_PRIORITY_CLASS ] }
{ +highest-priority+ [ HIGH_PRIORITY_CLASS ] }
{ +realtime-priority+ [ REALTIME_PRIORITY_CLASS ] }
[ drop f ]
} case ;
: app-name/cmd-line ( process -- app-name cmd-line )
command>> dup string? [
" " split1
@ -71,6 +82,7 @@ TUPLE: CreateProcess-args
0
pick pass-environment? [ CREATE_UNICODE_ENVIRONMENT bitor ] when
pick detached>> winnt? and [ DETACHED_PROCESS bitor ] when
pick lookup-priority [ bitor ] when*
>>dwCreateFlags ;
: fill-lpEnvironment ( process args -- process args )

View File

@ -125,7 +125,6 @@ TYPEDEF: FILE_NOTIFY_INFORMATION* PFILE_NOTIFY_INFORMATION
: OF_REOPEN 32768 ;
: OF_VERIFY 1024 ;
: INFINITE HEX: FFFFFFFF ; inline
! From C:\cygwin\usr\include\w32api\winbase.h