Last active
August 24, 2017 17:01
-
-
Save jonbodner/5f202cd9b98722239a9f1bc850238bfe to your computer and use it in GitHub Desktop.
future-blog-post-6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// New creates a new Future that wraps the provided function. | |
func New(inFunc Processor) Interface { | |
f := &futureImpl { | |
done: make(chan struct{}), | |
} | |
go func() { | |
f.val, f.err = inFunc() | |
close(f.done) | |
}() | |
return f | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment