在日常工作中常遇到这样的情况,我们需要一个监控线程用于随时的获得其他进程的任务请求,或者我们需要监视某些资源等的变化,一个高效的Monitor程序如何使用python语言实现呢?为了解决上述问题,我将我所使用的Monitor程序和大家分享,见代码:
1 import threading 2 import random 3 import time 4 import sys 5 6 class MonitorThread(threading.Thread): 7 def __init__(self, event): 8 threading.Thread.__init__(self) 9<