本文整理汇总了Python中multiprocessing.forking.ForkingPickler.loads方法的典型用法代码示例。如果您正苦于以下问题:Python ForkingPickler.loads方法的具体用法?Python ForkingPickler.loads怎么用?Python ForkingPickler.loads使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类multiprocessing.forking.ForkingPickler
的用法示例。
在下文中一共展示了ForkingPickler.loads方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get
# 需要导入模块: from multiprocessing.forking import ForkingPickler [as 别名]
# 或者: from multiprocessing.forking.ForkingPickler import loads [as 别名]
def get(self, block=True, timeout=None):
if block and timeout is None:
with self._rlock:
res = self._recv_bytes()
self._sem.release()
else:
if block:
deadline = time.time() + timeout
if not self._rlock.acquire(block, timeout):
raise Empty
try:
if block:
timeout = deadline - time.time()
if timeout < 0 or not self._poll(timeout):
raise Empty
elif not self._poll():
raise Empty
res = self._recv_bytes()
self._sem.release()
finally:
self._rlock.release()
# unserialize the data after having released the lock
return ForkingPickler.loads(res)
示例2: recv
# 需要导入模块: from multiprocessing.forking import ForkingPickler [as 别名]
# 或者: from multiprocessing.forking.ForkingPickler import loads [as 别名]
def recv(self):
"""Receive a (picklable) object"""
self._check_closed()
self._check_readable()
buf = self._recv_bytes()
return ForkingPickler.loads(buf.getbuffer())