config.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:CPU-Manager-for-Kubernetes 作者: Intel-Corp 项目源码 文件源码
def __acquire(self):
        max_lock = max_lock_seconds()

        def timed_out():
            logging.error("Lock timed out after {} seconds".format(max_lock))
            # NOTE(CD):
            #
            # Bail and rely on the operating system to close the open lock
            # file descriptor. They are closed on our behalf according to
            # the POSIX standard. See https://linux.die.net/man/2/exit
            #
            # We emulate Ctrl-C instead of raising SystemExit via sys.exit()
            # since exceptions are per-thread. SystemExit causes the
            # interpreter to exit if unhandled. This is the only
            # reliable way to trigger an exception in the main thread
            # to make this testable. Open to improvements.
            #
            # The interpreter exits with status 1.
            #
            # See https://goo.gl/RXsXEs
            _thread.interrupt_main()

        self.timer = threading.Timer(max_lock, timed_out)
        self.timer.start()
        # acquire file lock
        fcntl.flock(self.fd, fcntl.LOCK_EX)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号