Skip to content

thumbnailer: Fix thread related warnings

Bastien Nocera requested to merge wip/hadess/fix-thread-thumb-warnings into master

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: glib#2191 (closed)

Closes: #394 (closed)

Edited by Bastien Nocera

Merge request reports