def run(self):
"""
THIS IS BLOCKING! CALL IT AT LAST!
"""
with open(Job.lockFileName, 'w') as f:
rv = fcntl.lockf(f.fileno(), fcntl.LOCK_EX)
print("job {} is running.".format(os.getpid()))
f.write(str(os.getpid()) + '\n')
f.flush()
self.action()
fcntl.lockf(f.fileno(), fcntl.LOCK_UN)
评论列表
文章目录