当前位置: 首页>>代码示例>>Python>>正文


Python _multiprocessing.SemLock方法代码示例

本文整理汇总了Python中_multiprocessing.SemLock方法的典型用法代码示例。如果您正苦于以下问题:Python _multiprocessing.SemLock方法的具体用法?Python _multiprocessing.SemLock怎么用?Python _multiprocessing.SemLock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在_multiprocessing的用法示例。


在下文中一共展示了_multiprocessing.SemLock方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import _multiprocessing [as 别名]
# 或者: from _multiprocessing import SemLock [as 别名]
def __init__(self, kind, value, maxvalue):
        sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue)
        debug('created semlock with handle %s' % sl.handle)
        self._make_methods()

        if sys.platform != 'win32':
            def _after_fork(obj):
                obj._semlock._after_fork()
            register_after_fork(self, _after_fork) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:11,代码来源:synchronize.py

示例2: __setstate__

# 需要导入模块: import _multiprocessing [as 别名]
# 或者: from _multiprocessing import SemLock [as 别名]
def __setstate__(self, state):
        self._semlock = _multiprocessing.SemLock._rebuild(*state)
        debug('recreated blocker with handle %r' % state[0])
        self._make_methods()

#
# Semaphore
# 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:synchronize.py

示例3: __init__

# 需要导入模块: import _multiprocessing [as 别名]
# 或者: from _multiprocessing import SemLock [as 别名]
def __init__(self, kind, value, maxvalue, *, ctx):
        if ctx is None:
            ctx = context._default_context.get_context()
        name = ctx.get_start_method()
        unlink_now = sys.platform == 'win32' or name == 'fork'
        for i in range(100):
            try:
                sl = self._semlock = _multiprocessing.SemLock(
                    kind, value, maxvalue, self._make_name(),
                    unlink_now)
            except FileExistsError:
                pass
            else:
                break
        else:
            raise FileExistsError('cannot find name for semaphore')

        util.debug('created semlock with handle %s' % sl.handle)
        self._make_methods()

        if sys.platform != 'win32':
            def _after_fork(obj):
                obj._semlock._after_fork()
            util.register_after_fork(self, _after_fork)

        if self._semlock.name is not None:
            # We only get here if we are on Unix with forking
            # disabled.  When the object is garbage collected or the
            # process shuts down we unlink the semaphore name
            from .semaphore_tracker import register
            register(self._semlock.name)
            util.Finalize(self, SemLock._cleanup, (self._semlock.name,),
                          exitpriority=0) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:35,代码来源:synchronize.py

示例4: __setstate__

# 需要导入模块: import _multiprocessing [as 别名]
# 或者: from _multiprocessing import SemLock [as 别名]
def __setstate__(self, state):
        self._semlock = _multiprocessing.SemLock._rebuild(*state)
        util.debug('recreated blocker with handle %r' % state[0])
        self._make_methods() 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:6,代码来源:synchronize.py

示例5: _make_name

# 需要导入模块: import _multiprocessing [as 别名]
# 或者: from _multiprocessing import SemLock [as 别名]
def _make_name():
        return '%s-%s' % (process.current_process()._config['semprefix'],
                          next(SemLock._rand))

#
# Semaphore
# 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:9,代码来源:synchronize.py


注:本文中的_multiprocessing.SemLock方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。