本文整理匯總了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)