文件操作 - cfreactor.cpython-310.pyc
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/python3/dist-packages/twisted/internet/__pycache__/cfreactor.cpython-310.pyc
编辑文件内容
o �b[D � @ s� d Z ddgZddlZddlmZ ddlmZmZmZm Z m Z mZmZm Z mZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZ ddlmZ dd lm Z m!Z!m"Z" dd l#m$Z$ dZ%dZ&dZ'G d d� de"�Z(ee�G dd� de!��Z)ddd�Z*dS )z� A reactor for integrating with U{CFRunLoop<http://bit.ly/cfrunloop>}, the CoreFoundation main loop used by macOS. This is useful for integrating Twisted with U{PyObjC<http://pyobjc.sf.net/>} applications. �install� CFReactor� N)�implementer)�CFSocketCreateRunLoopSource�CFSocketCreateWithNative�CFSocketDisableCallBacks�CFSocketEnableCallBacks�CFSocketInvalidate�CFSocketSetSocketFlags�*kCFSocketAutomaticallyReenableReadCallBack�+kCFSocketAutomaticallyReenableWriteCallBack�kCFSocketConnectCallBack�kCFSocketReadCallBack�kCFSocketWriteCallBack)�CFAbsoluteTimeGetCurrent�CFRunLoopAddSource�CFRunLoopAddTimer�CFRunLoopGetMain�CFRunLoopRemoveSource�CFRunLoopRun� CFRunLoopStop�CFRunLoopTimerCreate�CFRunLoopTimerInvalidate�kCFAllocatorDefault�kCFRunLoopCommonModes)� IReactorFDSet)�_NO_FILEDESC�PosixReactorBase�_Waker)�log� �@ c @ s e Zd ZdZdd� ZdS )� _WakerPlusa� The normal Twisted waker will simply wake up the main loop, which causes an iteration to run, which in turn causes L{ReactorBase.runUntilCurrent} to get invoked. L{CFReactor} has a slightly different model of iteration, though: rather than have each iteration process the thread queue, then timed calls, then file descriptors, each callback is run as it is dispatched by the CFRunLoop observer which triggered it. So this waker needs to not only unblock the loop, but also make sure the work gets done; so, it reschedules the invocation of C{runUntilCurrent} to be immediate (0 seconds from now) even if there is no timed call work to do. c C s t �| �}| j�d� |S )zw Wake up the loop and force C{runUntilCurrent} to run immediately in the next timed iteration. T)r �doRead�reactor�_scheduleSimulate)�self�result� r( �</usr/lib/python3/dist-packages/twisted/internet/cfreactor.pyr# H s z_WakerPlus.doReadN)�__name__� __module__�__qualname__�__doc__r# r( r( r( r) r"