[linux-pm] [PATCH 06/11] PM: Add user-space wake lock api.

Brian Swetland swetland at google.com
Fri Jan 30 23:24:13 PST 2009


[Uli Luckas <u.luckas at road.de>]
> On Wednesday, 14. January 2009, Arve Hjønnevåg wrote:
> > This adds /sys/power/wake_lock and /sys/power/wake_unlock.
> > Writing a string to wake_lock creates a wake lock the
> > first time is sees a string and locks it. Optionally, the
> > string can be followed by a timeout.
> > To unlock the wake lock, write the same string to wake_unlock.
>
> What happens if a process takes a lock and then dies?
> Instead of using sysfs, how about using a device for this purpose which the 
> caller has to keep open as long as they want to hold the lock.

On the android platform this is not a concern since only the system
server manages wakelocks directly and processes use a higher level
wakelock api in userspace that is remoted and handles this situation
(the system server knows when a process dies and can clean up).

For more general usage, the fd model does sound nicer, allowing
cleanup-on-exit, etc.  Arve -- is there a reason we went with sysfs?

Brian


More information about the linux-pm mailing list