diff options
| author | Geoff Voelker | 1997-09-03 02:19:32 +0000 |
|---|---|---|
| committer | Geoff Voelker | 1997-09-03 02:19:32 +0000 |
| commit | 05c4be3c5a2fdc35ba4946efaaded8f0fdb68cc3 (patch) | |
| tree | 93fb9757127d18503da8cf63e7af092492f8b931 | |
| parent | 5f0fcedbfc05b9a4877ae9adb93e61eeb5b3b144 (diff) | |
| download | emacs-05c4be3c5a2fdc35ba4946efaaded8f0fdb68cc3.tar.gz emacs-05c4be3c5a2fdc35ba4946efaaded8f0fdb68cc3.zip | |
(WinMain): Allow Emacs process to be started with
high or low priority.
| -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) | |||
| 34 | SECURITY_DESCRIPTOR sec_desc; | 34 | SECURITY_DESCRIPTOR sec_desc; |
| 35 | PROCESS_INFORMATION child; | 35 | PROCESS_INFORMATION child; |
| 36 | int wait_for_child = FALSE; | 36 | int wait_for_child = FALSE; |
| 37 | DWORD priority_class = NORMAL_PRIORITY_CLASS; | ||
| 37 | DWORD ret_code = 0; | 38 | DWORD ret_code = 0; |
| 38 | char *new_cmdline; | 39 | char *new_cmdline; |
| 39 | char *p; | 40 | char *p; |
| @@ -82,13 +83,28 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) | |||
| 82 | strcat (new_cmdline, "\\emacs.exe "); | 83 | strcat (new_cmdline, "\\emacs.exe "); |
| 83 | #endif | 84 | #endif |
| 84 | 85 | ||
| 85 | /* Append original arguments if any; first look for -wait as first | 86 | /* Append original arguments if any; first look for arguments we |
| 86 | argument, and apply that ourselves. */ | 87 | recognise (-wait, -high, and -low), and apply them ourselves. */ |
| 87 | if (strncmp (cmdline, "-wait", 5) == 0) | 88 | while (cmdline[0] == '-' || cmdline[0] == '/') |
| 88 | { | 89 | { |
| 90 | if (strncmp (cmdline+1, "wait", 4) == 0) | ||
| 91 | { | ||
| 89 | wait_for_child = TRUE; | 92 | wait_for_child = TRUE; |
| 90 | cmdline += 5; | 93 | cmdline += 5; |
| 91 | } | 94 | } |
| 95 | else if (strncmp (cmdline+1, "high", 4) == 0) | ||
| 96 | { | ||
| 97 | priority_class = HIGH_PRIORITY_CLASS; | ||
| 98 | cmdline += 5; | ||
| 99 | } | ||
| 100 | else if (strncmp (cmdline+1, "low", 3) == 0) | ||
| 101 | { | ||
| 102 | priority_class = IDLE_PRIORITY_CLASS; | ||
| 103 | cmdline += 4; | ||
| 104 | } | ||
| 105 | else | ||
| 106 | break; | ||
| 107 | } | ||
| 92 | strcat (new_cmdline, cmdline); | 108 | strcat (new_cmdline, cmdline); |
| 93 | 109 | ||
| 94 | /* Set emacs_dir variable if runemacs was in "%emacs_dir%\bin". */ | 110 | /* Set emacs_dir variable if runemacs was in "%emacs_dir%\bin". */ |
| @@ -109,7 +125,7 @@ WinMain (HINSTANCE hSelf, HINSTANCE hPrev, LPSTR cmdline, int nShow) | |||
| 109 | sec_attrs.lpSecurityDescriptor = NULL; | 125 | sec_attrs.lpSecurityDescriptor = NULL; |
| 110 | sec_attrs.bInheritHandle = FALSE; | 126 | sec_attrs.bInheritHandle = FALSE; |
| 111 | 127 | ||
| 112 | if (CreateProcess (NULL, new_cmdline, &sec_attrs, NULL, TRUE, 0, | 128 | if (CreateProcess (NULL, new_cmdline, &sec_attrs, NULL, TRUE, priority_class, |
| 113 | NULL, NULL, &start, &child)) | 129 | NULL, NULL, &start, &child)) |
| 114 | { | 130 | { |
| 115 | if (wait_for_child) | 131 | if (wait_for_child) |