Module implementing queues
multiprocessing/queues.py
Copyright © 2006-2008, R Oudkerk
Licensed to PSF under a Contributor Agreement.
all = [‘Queue’, ‘SimpleQueue’, ‘JoinableQueue’]
import sys
import os
import threading
import collections
import time
import weakref
import errno
import queues
#import dataloader
from queue import Empty, Full
import _multiprocessing
from . import connection
from . import context
_ForkingPickler = context.reduction.ForkingPickler
from .util import debug, info, Finalize, register_after_fork, is_exiting
Queue type using a pipe, buffer and thread
class Queue(object):
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42def __init__(self, maxsize=0, *, ctx): if maxsize <= 0: # Can raise ImportError (see issues #3770 and #23400) from .synchronize import SEM_VALUE_MAX as maxsize self._maxsize = maxsize self._reader, self._writer = connection.Pipe(duplex=False) self._rlock = ctx.Lock() self._opid = os.getpid() if sys.platform == 'win32': self._wlock = None else: self._wlock = ctx.Lock() self._sem = ctx.BoundedSemaphore(maxsize) # For use by concurrent.futures self._ignore_epipe = False self._after_fork() if sys.platform != 'win32': register_after_fork(self, Queue._after_fork) def __getstate__(self): context.assert_spawning(self) return (self._ignore_epipe, self._maxsize, self._reader, self._writer, self._rlock, self._wlock, self._sem, self._opid) def __setstate__(self, state): (self._ignore_epipe, self._maxsize, self._reader, self._writer, self._rlock, self._wlock, self._sem, self._opid) = state self._after_fork() def _after_fork(self): debug('Queue._after_fork()') self._notempty = threading.Condition(threading.Lock()) self._buffer = collections.deque() self._thread = None self._jointhread = None self._joincancelled = False self._closed = False self._close = None self._send_bytes = self._writer.send_bytes self._recv_bytes = self._reader.recv_bytes
最后
以上就是傻傻发卡最近收集整理的关于ImportError: sys.meta_path is None, Python is likely shutting down报错,求助Module implementing queuesmultiprocessing/queues.pyCopyright © 2006-2008, R OudkerkLicensed to PSF under a Contributor Agreement.Queue type using a pipe, buffer and threadA queue 的全部内容,更多相关ImportError:内容请搜索靠谱客的其他文章。
发表评论 取消回复