本文整理汇总了Python中multiprocessing.sharedctypes.Array方法的典型用法代码示例。如果您正苦于以下问题:Python sharedctypes.Array方法的具体用法?Python sharedctypes.Array怎么用?Python sharedctypes.Array使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.sharedctypes
的用法示例。
在下文中一共展示了sharedctypes.Array方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Array
# 需要导入模块: from multiprocessing import sharedctypes [as 别名]
# 或者: from multiprocessing.sharedctypes import Array [as 别名]
def Array(typecode_or_type, size_or_initializer, *, lock=True):
'''
Returns a synchronized shared array
'''
from multiprocessing.sharedctypes import Array
return Array(typecode_or_type, size_or_initializer, lock=lock)
#
#
#
示例2: Array
# 需要导入模块: from multiprocessing import sharedctypes [as 别名]
# 或者: from multiprocessing.sharedctypes import Array [as 别名]
def Array(typecode_or_type, size_or_initializer, **kwds):
'''
Returns a synchronized shared array
'''
from multiprocessing.sharedctypes import Array
return Array(typecode_or_type, size_or_initializer, **kwds)
#
#
#
示例3: __init__
# 需要导入模块: from multiprocessing import sharedctypes [as 别名]
# 或者: from multiprocessing.sharedctypes import Array [as 别名]
def __init__(self, app):
usernames = app.config.get("SUPER_USERS", [])
usernames_str = ",".join(usernames)
self._max_length = len(usernames_str) + MAX_USERNAME_LENGTH + 1
self._array = Array("c", self._max_length, lock=True)
self._array.value = usernames_str.encode("utf8")
示例4: __init__
# 需要导入模块: from multiprocessing import sharedctypes [as 别名]
# 或者: from multiprocessing.sharedctypes import Array [as 别名]
def __init__(self, size=100):
# Lock handler.
self.lock = Lock()
# Array size.
self.size = size
# Array of Session.
self.sessions = Array(Session, self.size, lock=self.lock)