threading.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:pycam 作者: SebKuzminsky 项目源码 文件源码
def is_multiprocessing_available():
    if (pycam.Utils.get_platform() == pycam.Utils.OSPlatform.WINDOWS) and \
            hasattr(sys, "frozen") and sys.frozen:
        return False
    try:
        import multiprocessing
        # try to initialize a semaphore - this can trigger shm access failures
        # (e.g. on Debian Lenny with Python 2.6.6)
        multiprocessing.Semaphore()
        return True
    except ImportError:
        if "missing_module" not in __issued_warnings:
            log.info("Python's multiprocessing module is missing: disabling parallel processing")
            __issued_warnings.append("missing_module")
    except OSError:
        if "shm_access_failed" not in __issued_warnings:
            log.info("Python's multiprocessing module failed to acquire read/write access to "
                     "shared memory (shm) - disabling parallel processing")
            __issued_warnings.append("shm_access_failed")
    return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号