diff options
author | Geoff Voelker <voelker@cs.washington.edu> | 1997-09-03 02:19:32 +0000 |
---|---|---|
committer | Geoff Voelker <voelker@cs.washington.edu> | 1997-09-03 02:19:32 +0000 |
commit | 05c4be3c5a2fdc35ba4946efaaded8f0fdb68cc3 (patch) | |
tree | 93fb9757127d18503da8cf63e7af092492f8b931 /nt | |
parent | 5f0fcedbfc05b9a4877ae9adb93e61eeb5b3b144 (diff) | |
download | emacs-05c4be3c5a2fdc35ba4946efaaded8f0fdb68cc3.tar.gz |
(WinMain): Allow Emacs process to be started with
high or low priority.
Diffstat (limited to 'nt')
-rw-r--r-- | nt/runemacs.c | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/nt/runemacs.c b/nt/runemacs.c index 88e14a30d81..dc8d1bfe710 100644 --- a/nt/runemacs.c +++ b/nt/runemacs.c @@ -34,6 +34,7 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) SECURITY_DESCRIPTOR sec_desc; PROCESS_INFORMATION child; int wait_for_child = FALSE; + DWORD priority_class = NORMAL_PRIORITY_CLASS; DWORD ret_code = 0; char *new_cmdline; char *p; @@ -82,13 +83,28 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) strcat (new_cmdline, "\\emacs.exe "); #endif - /* Append original arguments if any; first look for -wait as first - argument, and apply that ourselves. */ - if (strncmp (cmdline, "-wait", 5) == 0) + /* Append original arguments if any; first look for arguments we + recognise (-wait, -high, and -low), and apply them ourselves. */ + while (cmdline[0] == '-' || cmdline[0] == '/') { + if (strncmp (cmdline+1, "wait", 4) == 0) + { wait_for_child = TRUE; cmdline += 5; } + else if (strncmp (cmdline+1, "high", 4) == 0) + { + priority_class = HIGH_PRIORITY_CLASS; + cmdline += 5; + } + else if (strncmp (cmdline+1, "low", 3) == 0) + { + priority_class = IDLE_PRIORITY_CLASS; + cmdline += 4; + } + else + break; + } strcat (new_cmdline, cmdline); /* Set emacs_dir variable if runemacs was in "%emacs_dir%\bin". */ @@ -109,7 +125,7 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) sec_attrs.lpSecurityDescriptor = NULL; sec_attrs.bInheritHandle = FALSE; - if (CreateProcess (NULL, new_cmdline, &sec_attrs, NULL, TRUE, 0, + if (CreateProcess (NULL, new_cmdline, &sec_attrs, NULL, TRUE, priority_class, NULL, NULL, &start, &child)) { if (wait_for_child) |