shutdown.py 文件源码

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

项目:petronia 作者: groboclown 项目源码 文件源码
def shutdown_system():
    worker_thread.stop_all_threads()
    _thread.interrupt_main()
    current_pid = funcs.process__get_current_pid()
    matched = False
    for hwnd in funcs.window__find_handles():
        pid = funcs.window__get_process_id(hwnd)
        if pid == current_pid:
            print("Sending PostMessage to hwnd owned by {0}".format(pid))
            funcs.window__post_message(hwnd, WM_QUIT, 0, 0)
            matched = True
            # Continue in case there are more windows we own
    if not matched:
        time.sleep(0.1)
        # print("DEBUG could not find a window to post a quit to.  Forcing quit.")
        # for t in threading.enumerate():
        #     print("Running thread: {0}".format(t))
        sys.exit()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号