-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow setting the priority of spawned subprocess
- Loading branch information
1 parent
4ef30b1
commit 51c2682
Showing
7 changed files
with
102 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,6 +18,7 @@ | |
#include <string> | ||
#include <vector> | ||
#include <queue> | ||
#include <limits.h> | ||
|
||
#ifdef _WIN32 | ||
#include <windows.h> | ||
|
@@ -52,7 +53,11 @@ struct Subprocess { | |
|
||
private: | ||
Subprocess(bool use_console); | ||
bool Start(struct SubprocessSet* set, const std::string& command); | ||
// priority: | ||
// - The range of possible values is platform dependent | ||
// - POSIX: variable between scheduling policies between sched_get_priority_min() and sched_get_priority_max() | ||
// - Windows: between -20 (highest priority) and 20 (lowest priority) | ||
This comment has been minimized.
Sorry, something went wrong.
digit-google
Contributor
|
||
bool Start(struct SubprocessSet* set, const std::string& command, int priority); | ||
void OnPipeReady(); | ||
|
||
std::string buf_; | ||
|
@@ -83,7 +88,8 @@ struct SubprocessSet { | |
SubprocessSet(); | ||
~SubprocessSet(); | ||
|
||
Subprocess* Add(const std::string& command, bool use_console = false); | ||
Subprocess* Add(const std::string& command, int priority = INT_MIN, | ||
bool use_console = false); | ||
This comment has been minimized.
Sorry, something went wrong.
digit-google
Contributor
|
||
bool DoWork(); | ||
Subprocess* NextFinished(); | ||
void Clear(); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
nit: s/depdening/depending/. Also prefer something like
POSIX: In -20..19 range, and -20..20 on some systems, see 'man setpriority'
.