35 lines
468 B
Go
35 lines
468 B
Go
package q1114
|
|
|
|
type Foo struct {
|
|
one, two chan struct{}
|
|
}
|
|
|
|
func NewFoo() *Foo {
|
|
return &Foo{
|
|
one: make(chan struct{}),
|
|
two: make(chan struct{}),
|
|
}
|
|
}
|
|
|
|
func (f *Foo) First(printFirst func()) {
|
|
// Do not change this line
|
|
printFirst()
|
|
|
|
close(f.one)
|
|
}
|
|
|
|
func (f *Foo) Second(printSecond func()) {
|
|
<-f.one
|
|
|
|
/// Do not change this line
|
|
printSecond()
|
|
|
|
close(f.two)
|
|
}
|
|
|
|
func (f *Foo) Third(printThird func()) {
|
|
<-f.two
|
|
|
|
// Do not change this line
|
|
printThird()
|
|
}
|