A condition-variable based Future type for synchronization in Go.
Controls an accompanying pointer, like Mutex or Cond, rather than trying to hack around the lack of generics.
package main
import future "github.com/reem/go-future"
import "fmt"
type Data struct {
x int
}
func main() {
data := &Data{0}
producer, consumer := future.Pair()
go func() {
data.x = 12
producer.Complete()
}()
go func() {
consumer.Await()
fmt.Println("Received data, data.x ==", data.x)
}()
}Jonathan Reem is the primary author and maintainer of future.
MIT