In the first quarter of 2018, the demand for blockchain-related talent had reached 9.7 times times the same period in 2017, with a 4.6 times-fold increase in the number of companies publishing blockchain-related posts.
Brother Lian Education go all-in-one and Blockchain training courses are unique, structured courses developed by Tsinghua, Microsoft, and Google teachers over the course of a half-year period.
Golang does not provide time-outs at the language level, but it can be timed out with some small tricks.
Principle:
Concurrent a function, waiting for 1s to write data to timeout, in the Select if there is data in the 1s to the other channel write will be executed smoothly, if not, this is timeout write data, we know the timeout.
Package Main
Import "FMT"
Import "Time"
Func Main () {
CH: = Make (chan int, 1)
Timeout: = Make (chan bool, 1)
Executes a function concurrently, waiting for 1s to write to timeout to true
Go func () {
Time. Sleep (1000)
Timeout <-True
}()
This will wait for CH or timeout to read the data
Because no data has been written to Ch
Data is written to timeout after 1s
So the case of timeout was executed.
Use this technique to implement a timeout operation
Select {
Case <-Ch:
Fmt. Println ("read from ch")
Case <-Timeout:
Fmt. Println ("Time Out ...")
}
}