Skip to content
  • Bastien Nocera's avatar
    thumbnailer: Fix thread related warnings · c69f9c25
    Bastien Nocera authored
    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: GNOME/glib#2191
    
    Closes: #394
    c69f9c25