mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-10-29 05:40:23 -04:00
Merge branch 'autogroup-nice' into 'master'
core-util: Set nice value for the task group Closes #792 See merge request pulseaudio/pulseaudio!234
This commit is contained in:
commit
d09d81da55
1 changed files with 13 additions and 0 deletions
|
|
@ -699,6 +699,10 @@ char *pa_strlcpy(char *b, const char *s, size_t l) {
|
|||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
static int set_nice(int nice_level) {
|
||||
#ifdef __linux__
|
||||
FILE* f;
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_DBUS
|
||||
DBusError error;
|
||||
DBusConnection *bus;
|
||||
|
|
@ -707,6 +711,15 @@ static int set_nice(int nice_level) {
|
|||
dbus_error_init(&error);
|
||||
#endif
|
||||
|
||||
#ifdef __linux__
|
||||
if (!(f = pa_fopen_cloexec("/proc/self/autogroup", "w"))) {
|
||||
pa_log_info("Failed to open autogroup");
|
||||
} else {
|
||||
fprintf(f, "%d", nice_level);
|
||||
fclose(f);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_SYS_RESOURCE_H
|
||||
if (setpriority(PRIO_PROCESS, 0, nice_level) >= 0) {
|
||||
pa_log_debug("setpriority() worked.");
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue