MCPcopy Index your code
hub / github.com/foxcpp/maddy / Set

Method Set

framework/future/future.go:48–68  ·  view source on GitHub ↗

Set sets the Future (value, error) pair. All currently blocked and future Get calls will return it.

(val interface{}, err error)

Source from the content-addressed store, hash-verified

46// Set sets the Future (value, error) pair. All currently blocked and future
47// Get calls will return it.
48func (f *Future) Set(val interface{}, err error) {
49 if f == nil {
50 panic("nil future used")
51 }
52
53 f.mu.Lock()
54 defer f.mu.Unlock()
55
56 if f.set {
57 stack := debug.Stack()
58 log.Println("Future.Set called multiple times", stack)
59 log.Println("value=", val, "err=", err)
60 return
61 }
62
63 f.set = true
64 f.val = val
65 f.err = err
66
67 close(f.notify)
68}
69
70func (f *Future) Get() (interface{}, error) {
71 if f == nil {

Callers 9

TestFuture_SetBeforeGetFunction · 0.45
TestFuture_WaitFunction · 0.45
assignMethod · 0.45
ModuleFromNodeFunction · 0.45
fetchRDNSNameMethod · 0.45
submissionPrepareMethod · 0.45
CheckConnectionMethod · 0.45
TestRequireMatchingRDNSFunction · 0.45

Calls 1

PrintlnFunction · 0.92

Tested by 4

TestFuture_SetBeforeGetFunction · 0.36
TestFuture_WaitFunction · 0.36
TestRequireMatchingRDNSFunction · 0.36