Async variant to check whether power management is inhibited
ClosedPublic

Authored by graesslin on Jan 29 2016, 2:18 PM.

Details

Summary

KScreenLocker checks whether power management is inhibited on idle
time out. So far this used a sync and blocking dbus call.

This change makes the check async. KScreenLocker connects to the
InhibitionsChanged signal provided by powerdevil and queries the
current state in an async way each time the signal gets emitted.

When KScreenLocker hits an idle connection it has the knowledge wheter
power management is inhibited and does not need to perform the blocking
call any more.

It's important for KScreenLocker to not have blocking calls as it's
used inside the Wayland compositor and can by that easily create
dead-lock situations (e.g. PowerDevil waiting for the Wayland compositor
and the compositor waiting for the reply).

Diff Detail

Repository
R133 KScreenLocker
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin updated this revision to Diff 2139.Jan 29 2016, 2:18 PM
graesslin retitled this revision from to Async variant to check whether power management is inhibited.
graesslin updated this object.
graesslin edited the test plan for this revision. (Show Details)
graesslin added reviewers: bshah, broulik.
Restricted Application added a project: Plasma. · View Herald TranscriptJan 29 2016, 2:18 PM
Restricted Application added a subscriber: plasma-devel. · View Herald Transcript
broulik accepted this revision.Feb 1 2016, 11:28 AM
broulik edited edge metadata.

Not really happy with 3rd party using InhibitionsChanged signal because I find it quite horrible in retrospect, and will probably need to change it for our future Inhibitions plasmoid but we can still adjust here when we get this far.

powermanagement_inhibition.cpp
100

InterruptSession is "suspend", I think we still want the screen to lock while listening to music where only change screen settings would be set

This revision is now accepted and ready to land.Feb 1 2016, 11:28 AM
This revision was automatically updated to reflect the committed changes.

Excellent! That synchronous call might have caused deadlocks before.