summaryrefslogtreecommitdiff
path: root/benchmarks/CUDA/CP/driver/futures.py
blob: 2e0b94bb18edda871af792979cbcb66ffe18cff2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# (c) 2007 The Board of Trustees of the University of Illinois.

class Future:
    def __init__(self, thunk):
        self.evaluated = 0
        self.value = thunk

    def get(self):
        if self.evaluated:
            return self.value
        else:
            self.value = self.value()
            self.evaluated = 1
            return self.value