From 1ff27e7de5f42914217cc1d2075ac1273143a406 Mon Sep 17 00:00:00 2001 From: Doug Coleman Date: Mon, 24 Mar 2008 17:25:03 -0500 Subject: [PATCH] rename process to priority --- extra/io/process/process.factor | 17 +++++++++++++++++ extra/io/unix/process/process.factor | 19 +++++++++++++++++++ extra/io/windows/process/priority.factor | 8 ++++++++ extra/io/windows/process/process.factor | 8 ++++++++ 4 files changed, 52 insertions(+) create mode 100644 extra/io/process/process.factor create mode 100644 extra/io/unix/process/process.factor create mode 100644 extra/io/windows/process/priority.factor create mode 100644 extra/io/windows/process/process.factor diff --git a/extra/io/process/process.factor b/extra/io/process/process.factor new file mode 100644 index 0000000000..8a7c5b1a11 --- /dev/null +++ b/extra/io/process/process.factor @@ -0,0 +1,17 @@ +USING: io.backend kernel ; +IN: io.priority + +SYMBOL: +lowest-priority+ +SYMBOL: +low-priority+ +SYMBOL: +normal-priority+ +SYMBOL: +high-priority+ +SYMBOL: +highest-priority+ + +HOOK: current-priority io-backend ( -- symbol ) +HOOK: set-current-priority io-backend ( symbol -- ) +HOOK: priority-values ( -- assoc ) + +: lookup-priority ( symbol -- n ) + priority-values at ; + +HOOK: get-process-list io-backend ( -- assoc ) diff --git a/extra/io/unix/process/process.factor b/extra/io/unix/process/process.factor new file mode 100644 index 0000000000..00df6b6f52 --- /dev/null +++ b/extra/io/unix/process/process.factor @@ -0,0 +1,19 @@ +USING: alien.syntax kernel io.process io.unix.backend +unix ; +IN: io.unix.process + +M: unix-io current-priority ( -- n ) + clear_err_no + 0 0 getpriority dup -1 = [ check-errno ] when ; + +M: unix-io set-current-priority ( n -- ) + 0 0 rot setpriority io-error ; + +M: unix-io priority-values ( -- assoc ) + { + { +lowest-priority+ 20 } + { +low-priority+ 10 } + { +normal-priority+ 0 } + { +high-priority+ -10 } + { +highest-priority+ -20 } + } ; diff --git a/extra/io/windows/process/priority.factor b/extra/io/windows/process/priority.factor new file mode 100644 index 0000000000..f0ca04fd8a --- /dev/null +++ b/extra/io/windows/process/priority.factor @@ -0,0 +1,8 @@ +USING: kernel ; +IN: io.windows.process + +M: windows-io current-priority ( -- n ) + ; + +M: windows-io set-current-priority ( n -- ) + ; diff --git a/extra/io/windows/process/process.factor b/extra/io/windows/process/process.factor new file mode 100644 index 0000000000..f0ca04fd8a --- /dev/null +++ b/extra/io/windows/process/process.factor @@ -0,0 +1,8 @@ +USING: kernel ; +IN: io.windows.process + +M: windows-io current-priority ( -- n ) + ; + +M: windows-io set-current-priority ( n -- ) + ;