5

Programs that depend on physical time, such as jackd and its clients, do not play well with software suspend of a laptop in linux. I would like to fix a client that starts issuing plenty of "timing errors" by letting it disconnect before software suspend and reconnect on resume. Can this be done from the client, without the need for system configuration? I know I could kill the program by editing system scripts, but is there an interface in linux to wait for suspend events directly, and without root permissions? Are you aware of programs that depend on physical time but handle suspend correctly?

0

If a program depends on physical time, it must check the clock periodically anyway. Unless this is a real-time program running on a version of Linux with kernel patches for real-time guarantees, a process may be stopped from executing for an arbitrary length of time by the scheduler. A process may also be stopped by a STOP signal (it can know of that by putting a handler on the CONT signal sent to resume it).

If the software merely needs to know that a long amount of time has elapsed, it can put a timer to wake it up. However, the example that you give needs to know more than that: it needs to be aware of network configuration changes, for example. For such a program, hooking onto system suspend/resume events provide more information than merely detecting time skips.

Hooking onto system suspend/resume events requires either root privileges, or running inside a session with D-Bus access. (I don't know what D-Bus events you need to subscribe to.)

Hooking onto system suspend/resume events has the advantage that you can run code on suspend, not just on resume.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.