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

Arve Hjønnevåg
2009-01-31T00:17:30Z

On Fri, Jan 30, 2009 at 4:43 AM, Uli Luckas <u.luckas@road.de> wrote:
> 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?

The lock will be held until the process restarts and unlocks it. We
only use this interface directly from processes that are started (and
restarted) from init. Applications use the user space api which talks
to our system process. If an application dies the system process is
notified and (userspace) wakelocks are deleted.

> 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.

If you want to use wakelocks directly from applications, that makes
sense, but I'm not sure we also want to remove this interface.

--
Arve Hjønnevåg