From 65a12660a73f23e98920377b9e959d8dd1a34627 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Wed, 26 Mar 2008 15:55:55 -0500 Subject: [PATCH] implement priorities on windows --- extra/io/launcher/launcher.factor | 1 + extra/io/unix/launcher/launcher.factor | 1 + extra/io/windows/launcher/launcher.factor | 12 ++++++++++++ extra/windows/kernel32/kernel32.factor | 1 - 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/extra/io/launcher/launcher.factor b/extra/io/launcher/launcher.factor index ac8dc15661..79382091ab 100755 --- a/extra/io/launcher/launcher.factor +++ b/extra/io/launcher/launcher.factor @@ -38,6 +38,7 @@ SYMBOL: +low-priority+ SYMBOL: +normal-priority+ SYMBOL: +high-priority+ SYMBOL: +highest-priority+ +SYMBOL: +realtime-priority+ : ( -- process ) process construct-empty diff --git a/extra/io/unix/launcher/launcher.factor b/extra/io/unix/launcher/launcher.factor index e16ecde6fa..11c608c68f 100755 --- a/extra/io/unix/launcher/launcher.factor +++ b/extra/io/unix/launcher/launcher.factor @@ -24,6 +24,7 @@ USE: unix { +normal-priority+ 0 } { +high-priority+ -10 } { +highest-priority+ -20 } + { +realtime-priority+ -20 } } at set-priority ] when* ; diff --git a/extra/io/windows/launcher/launcher.factor b/extra/io/windows/launcher/launcher.factor index ca8f5f3e59..2d281d0fe8 100755 --- a/extra/io/windows/launcher/launcher.factor +++ b/extra/io/windows/launcher/launcher.factor @@ -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 ) diff --git a/extra/windows/kernel32/kernel32.factor b/extra/windows/kernel32/kernel32.factor index 22a86818cf..ec70b14e68 100644 --- a/extra/windows/kernel32/kernel32.factor +++ b/extra/windows/kernel32/kernel32.factor @@ -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