本文介绍了Linux中是否有暂停\恢复信号?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序需要在休眠模式下作出反应,因此它可以对挂起执行某些操作,对恢复执行其他操作.我找到了一些特定于发行版的方法来实现它(Upower + DBus),但是没有发现任何通用的方法.有办法吗?

My application needs to react on hibernation mode so it can do some action on suspending and other actions on resuming. I've found some distributive-specific ways to achieve it(Upower + DBus) but didn't find anything universal. Is there a way to do it?

谢谢!

推荐答案

我相信您正在寻找SIGSTOP和SIGCONT信号.您可以将它们发送到正在运行的进程中,如下所示:

I believe you are looking for SIGSTOP and SIGCONT signals. You can send these to a running process like so:

kill -STOP pid
sleep 60
kill -CONT pid

这篇关于Linux中是否有暂停\恢复信号?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-20 16:51