MCPcopy Create free account
hub / github.com/MegEngine/MegEngine / Future

Class Future

imperative/python/megengine/utils/future.py:4–19  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2
3
4class Future:
5 def __init__(self, ack=True):
6 self.ready = threading.Event()
7 self.ack = threading.Event() if ack else None
8
9 def set(self, value):
10 self.value = value
11 self.ready.set()
12 if self.ack:
13 self.ack.wait()
14
15 def get(self):
16 self.ready.wait()
17 if self.ack:
18 self.ack.set()
19 return self.value

Callers 3

bcast_valMethod · 0.50
test_ioFunction · 0.50
test_opFunction · 0.50

Calls

no outgoing calls

Tested by 2

test_ioFunction · 0.40
test_opFunction · 0.40