diff options
author | Bastien Nocera <hadess@hadess.net> | 2020-08-25 13:08:09 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2020-08-25 13:10:57 +0200 |
commit | c69f9c258e89d03de59e031677ed41005f157378 (patch) | |
tree | 9f2d81d2af536084d8d64fb1dfca2fc35cca9071 /src | |
parent | e2d3c47c34eca15e7c8ed285cb7af92378d9069f (diff) | |
download | totem-c69f9c258e89d03de59e031677ed41005f157378.tar.gz |
thumbnailer: Fix thread related warnings
When running, totem-video-thumbnailer would throw loads of warnings related to not being able to set the scheduler settings.
(totem-video-thumbnailer:4797): GLib-CRITICAL **: 22:45:48.120: Failed to set scheduler settings: Operation not permitted
(totem-video-thumbnailer:4797): GLib-CRITICAL **: 22:45:48.239: Failed to set scheduler settings: Operation not permitted
(totem-video-thumbnailer:4797): GLib-CRITICAL **: 22:45:48.242: Failed to set scheduler settings: Operation not permitted
(totem-video-thumbnailer:4797): GLib-CRITICAL **: 22:45:48.605: Failed to set scheduler settings: Operation not permitted
(totem-video-thumbnailer:4797): GLib-CRITICAL **: 22:45:48.706: Failed to set scheduler settings: Operation not permitted
This is caused by the global shared GThreadPool being spawned by gst_init()
through options parsing, before totem-video-thumbnailer drops the nice value
to 20. The few spare GThreadPool threads are using a nice value of 0, and
will try to apply it to the new threads. But they're spawned from the main
thread which has a nice of 0, so the code will try to change the nice value
to match, which isn't allowed by kernel policies.
Work-around this by running nice(20) before the thread pool is created.
See: https://gitlab.gnome.org/GNOME/glib/-/issues/2191
Closes: #394
Diffstat (limited to 'src')
-rw-r--r-- | src/totem-video-thumbnailer.c | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/totem-video-thumbnailer.c b/src/totem-video-thumbnailer.c index 5f0d4ab75..ec2c5c4af 100644 --- a/src/totem-video-thumbnailer.c +++ b/src/totem-video-thumbnailer.c @@ -606,6 +606,11 @@ int main (int argc, char *argv[]) bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); + /* Call before the global thread pool is setup */ + errno = 0; + if (nice (20) != 20 && errno != 0) + g_warning ("Couldn't change nice value of process."); + context = g_option_context_new ("Thumbnail movies"); options = gst_init_get_option_group (); g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE); @@ -617,14 +622,6 @@ int main (int argc, char *argv[]) return 1; } -#ifdef G_OS_UNIX - if (time_limit != FALSE) { - errno = 0; - if (nice (20) != 20 && errno != 0) - g_warning ("Couldn't change nice value of process."); - } -#endif - if (print_progress) { fcntl (fileno (stdout), F_SETFL, O_NONBLOCK); setbuf (stdout, NULL); |