Skip to content
Snippets Groups Projects
Commit c58184c0 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

added DeferredValue.result

Change-Id: I85802737669464a529e6f18694db6b6817c5b0ad
parent 1560e2ac
No related branches found
No related tags found
No related merge requests found
...@@ -43,10 +43,15 @@ class DeferredValue(tp.Generic[T]): ...@@ -43,10 +43,15 @@ class DeferredValue(tp.Generic[T]):
self.val = va self.val = va
self.lock.set() self.lock.set()
def result(self, timeout=None) -> T:
"""An alias for :meth:`~satella.coding.concurrent.DeferredValue.value`"""
return self.value(timeout)
def value(self, timeout: tp.Optional[float] = None) -> T: def value(self, timeout: tp.Optional[float] = None) -> T:
""" """
Wait until value is available. Wait until value is available.
:param timeout: number of seconds to wait. If None is given, this will take as long as necessary.
:return: a value :return: a value
:raises WouldWaitMore: timeout was given and it has expired :raises WouldWaitMore: timeout was given and it has expired
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment