%PDF- %PDF-
Direktori : /lib/python3/dist-packages/twisted/internet/__pycache__/ |
Current File : //lib/python3/dist-packages/twisted/internet/__pycache__/cfreactor.cpython-312.pyc |
� Ϫ�f[ � �" � d Z ddlmZ ddgZddlZddlmZ ddlmZm Z m Z mZmZm Z mZmZmZmZmZ ddlmZmZmZmZmZmZmZmZmZmZmZ dd lm Z dd l!m"Z"m#Z# ddl$m%Z% dd l&m'Z' dZ(dZ)dZ* G d� de'� Z+ ee � G d� de#� � Z,dd�Z-y)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. � )�annotations�install� CFReactorN)�implementer)�CFSocketCreateRunLoopSource�CFSocketCreateWithNative�CFSocketDisableCallBacks�CFSocketEnableCallBacks�CFSocketInvalidate�CFSocketSetSocketFlags�*kCFSocketAutomaticallyReenableReadCallBack�+kCFSocketAutomaticallyReenableWriteCallBack�kCFSocketConnectCallBack�kCFSocketReadCallBack�kCFSocketWriteCallBack)�CFAbsoluteTimeGetCurrent�CFRunLoopAddSource�CFRunLoopAddTimer�CFRunLoopGetCurrent�CFRunLoopRemoveSource�CFRunLoopRun� CFRunLoopStop�CFRunLoopTimerCreate�CFRunLoopTimerInvalidate�kCFAllocatorDefault�kCFRunLoopCommonModes)� IReactorFDSet)�_NO_FILEDESC�PosixReactorBase)�log� )� _UnixWaker�@ c �, � � e Zd ZdZ� fd�Z� fd�Z� xZS )� _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 �0 �� t �| � � || _ y �N)�super�__init__�reactor)�selfr* � __class__s ��</usr/lib/python3/dist-packages/twisted/internet/cfreactor.pyr) z_WakerPlus.__init__N s �� � ������� c �Z �� t �| � � }| j j d� |S )zw Wake up the loop and force C{runUntilCurrent} to run immediately in the next timed iteration. T)r( �doReadr* �_scheduleSimulate)r+ �resultr, s �r- r0 z_WakerPlus.doReadR s( �� � ���!�����&�&�t�,�� r. )�__name__� __module__�__qualname__�__doc__r) r0 � __classcell__�r, s @r- r% r% = s �� �� �� r. r% c �� � � e Zd ZU dZdd�Zdd�Zd� Zd� Zd� Zd� Z d � Z d � Zd� Zd� Z d � Zd� Zd� Zd� Zdd� fd� ZdZd d�ZdZded<