Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
xujihui1985 committed Oct 30, 2018
1 parent cdfdcd1 commit 749ad0d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions chan/future/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ func withFuture(ca, cb string) {
}

func main(){

// this is ok, but not ideal, because fa and fb will be invoke sequencely
withFuture(<-fa(), <-fb())

// this is good because fa and fb are invoke concurrently
ca, cb := fa(), fb()
withFuture(<-ca, <-cb)
}

0 comments on commit 749ad0d

Please sign in to comment.