我是靠谱客的博主 傻傻发卡,最近开发中收集的这篇文章主要介绍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 ,觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

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):

def __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: 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 所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(35)

评论列表共有 0 条评论

立即
投稿
返回
顶部