解释了正确的守护程序行为(来自PEP 3143) [英] Correct daemon behaviour (from PEP 3143) explained

查看:119
本文介绍了解释了正确的守护程序行为(来自PEP 3143)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Python中有一些[针对RPi]的任务,涉及很多sleep处理:做一些需要一秒钟或两到三秒的事情,然后再等待几分钟或几小时. 我想在那段睡眠时间内将控制权交还给OS(Linux).为此,我应该守护这些任务.一种方法是使用Python的标准守护程序进程库.

I have some tasks [for my RPi] in Python that involve a lot of sleeping: do something that takes a second or two or three, then go wait for several minutes or hours. I want to pass control back to the OS (Linux) in that sleep time. For this, I should daemonise those tasks. One way is by using Python's Standard daemon process library.

但是守护进程并不是那么容易理解.根据 PEP 3143 的原理部分表现良好的守护程序应执行以下操作.

But daemons aren't so easy to understand. As per the Rationale paragraph of PEP 3143, a well behaved daemon should do the following.

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆