Re: [PATCH 01/13] PM: Add wake lock api.

Matthew Garrett
2009-02-13T14:37:30Z

On Fri, Feb 13, 2009 at 06:24:09AM -0800, Brian Swetland wrote:

> I think the "what happens when a process crashes and its suspend
> inhibits are released" issue still needs some thought -- if say a
> background/service process crashes while holding a lock we want to
> have the process be able to be restarted by init or whatnot without
> having to wait for some other activity. This is a real example we
> ran into in the past -- telephony process crashes and the device
> doesn't get back on the network until the user presses a key, an
> alarm fires, etc.

The easiest way to handle this would seem to be a multiplexing daemon
that implements whatever policy a specific use case has. In your case
this would do its own reference counting and then implement timeouts for
specific applications, perhaps with some kind of acl so arbitrary apps
can't take a lock and then fall down a well. If you've got a
sufficiently advanced init then you'd be able to flag an application as
being in restart state and then have the daemon hold the lock until the
application chooses to reacquire it or not, which seems more flexible
than any purely kernel-based implementation.

--
Matthew Garrett | mjg59@srcf.ucam.org