mainloop_terminate_ctrl_c.py 文件源码

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

项目:scarlett_os 作者: bossjones 项目源码 文件源码
def attach_readfd(iochannel, context):
    # This does not work currently :-(
    # Also, things are mixed up a bit with iochannel vs. FDs apparently
    # as I am getting an int back in the handler
    # if isinstance(iochannel, int):
    #    iochannel = GLib.IOChannel(iochannel)
    #source = GLib.io_create_watch(iochannel, GLib.IOCondition(GLib.IO_IN | GLib.IO_PRI))
    #source.set_callback(_glib_signal_cb, context)
    # source.set_priority(GLib.PRIORITY_HIGH)
    # source.attach(context)
    GLib.io_add_watch(iochannel, GLib.IO_IN | GLib.IO_PRI, _glib_signal_cb, context)


# Now, this is our magic exception hook. It is *magic*
# it detects whether the exception happened in our signal handler.
# The fun part is that the handler does not run properly. The mainloop
# will actually try to run it again as soon as it can (if it manages).
# We use that to clear the exception option again.
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号