Skip to content
  • Tomáš Trnka's avatar
    Fix drain_console unregistration · 323869f3
    Tomáš Trnka authored and Peter Hutterer's avatar Peter Hutterer committed
    Bug introduced by 9dca4416
    
    
    xfree86: add a hook to replace the new console handler.
    
    console_handler was not being set, making the server eat up CPU spinning
    in WaitForSomething selecting consoleFd over and over again, every time
    trying to unregister drain_console without success due to
    console_handler being NULL.
    
    Let's just fix the unregistration in xf86SetConsoleHandler() and use that.
    
    But wait, there could be a catch: If some driver replaced the handler using
    xf86SetConsoleHandler(), the unregistration in xf86CloseConsole will unregister
    that one. I don't understand Xorg well enough to know whether this poses a
    problem (could mess up driver deinit somehow or something like that). As it is,
    xf86SetConsoleHandler() doesn't offer any way to prevent this (i.e. check which
    handler is currently registered).
    
    I had been using it for two days on my machine that previously hit 100% CPU
    several times a day. That has now gone away without any new problems appearing.
    
    Signed-off-by: default avatarTomas Trnka <tomastrnka@gmx.com>
    Reviewed-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
    Signed-off-by: default avatarPeter Hutterer <peter.hutterer@who-t.net>
    323869f3