2013-08-27 13:18:32 -06:00
|
|
|
// Copyright 2013 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2013-08-05 14:09:53 -06:00
|
|
|
package a
|
|
|
|
|
|
|
|
type Package struct {
|
|
|
|
name string
|
|
|
|
}
|
|
|
|
|
|
|
|
type Future struct {
|
|
|
|
result chan struct {
|
|
|
|
*Package
|
2013-08-27 13:18:32 -06:00
|
|
|
error
|
2013-08-05 14:09:53 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-08-27 13:18:32 -06:00
|
|
|
func (t *Future) Result() (*Package, error) {
|
2013-08-05 14:09:53 -06:00
|
|
|
result := <-t.result
|
|
|
|
t.result <- result
|
2013-08-27 13:18:32 -06:00
|
|
|
return result.Package, result.error
|
2013-08-05 14:09:53 -06:00
|
|
|
}
|