관리-도구
편집 파일: process.cpython-34.pyo
� j f�D � @ sv d Z d Z d d l Z d d l Z d d l m Z d d l Z d d l m Z d d l Z d d l m Z d d l m Z d d l Z d d l Z e j � Z d a d d � Z d Z Gd d � d e � Z Gd d � d e � Z Gd d � d e � Z d d � Z d d � Z d d � Z d a d a d d � Z Gd d � d e � Z Gd d � d e j � Z e j! e � d S)a* Implements ProcessPoolExecutor. The follow diagram and text describe the data-flow through the system: |======================= In-process =====================|== Out-of-process ==| +----------+ +----------+ +--------+ +-----------+ +---------+ | | => | Work Ids | => | | => | Call Q | => | | | | +----------+ | | +-----------+ | | | | | ... | | | | ... | | | | | | 6 | | | | 5, call() | | | | | | 7 | | | | ... | | | | Process | | ... | | Local | +-----------+ | Process | | Pool | +----------+ | Worker | | #1..n | | Executor | | Thread | | | | | +----------- + | | +-----------+ | | | | <=> | Work Items | <=> | | <= | Result Q | <= | | | | +------------+ | | +-----------+ | | | | | 6: call() | | | | ... | | | | | | future | | | | 4, result | | | | | | ... | | | | 3, except | | | +----------+ +------------+ +--------+ +-----------+ +---------+ Executor.submit() called: - creates a uniquely numbered _WorkItem and adds it to the "Work Items" dict - adds the id of the _WorkItem to the "Work Ids" queue Local worker thread: - reads work ids from the "Work Ids" queue and looks up the corresponding WorkItem from the "Work Items" dict: if the work item has been cancelled then it is simply removed from the dict, otherwise it is repackaged as a _CallItem and put in the "Call Q". New _CallItems are put in the "Call Q" until "Call Q" is full. NOTE: the size of the "Call Q" is kept small because calls placed in the "Call Q" can no longer be cancelled with Future.cancel(). - reads _ResultItems from "Result Q", updates the future stored in the "Work Items" dict and deletes the dict entry Process #1..n: - reads _CallItems from "Call Q", executes the calls, and puts the resulting _ResultItems in "Result Q" z"Brian Quinlan (brian@sweetapp.com)� N)�_base)�Full)�SimpleQueue)�waitFc C sa d a t t j � � } x! | D] \ } } | j d � q Wx | D] \ } } | j � qC Wd S)NT)� _shutdown�list�_threads_queues�items�put�join)r �t�q� r �?/opt/alt/python34/lib64/python3.4/concurrent/futures/process.py�_python_exitL s r � c @ s e Z d Z d d � Z d S)� _WorkItemc C s( | | _ | | _ | | _ | | _ d S)N)�future�fn�args�kwargs)�selfr r r r r r r �__init__\ s z_WorkItem.__init__N)�__name__� __module__�__qualname__r r r r r r [ s r c @ s"