func (af *AutoFile) closeFileRoutine() { for { select { case <-af.closeTicker.C: _= af.closeFile() case <-af.closeTickerStopc: return } } }
We want to connect the people who have knowledge to the people who need it, to bring together people with different perspectives so they can understand each other better, and to empower everyone to share their knowledge.
func (af *AutoFile) closeFileRoutine() { for { select { case <-af.closeTicker.C: _= af.closeFile() case <-af.closeTickerStopc: return } } }
af.closeTicker.C
và af.closeTickerStopc
là 2 channel, đoạn code trên đợi lấy event từ 2 channel này, nếu nhận event từ channel af.closeTicker.C
thì sẽ đóng file, còn nếu nhận event từ channel af.closeTickerStopc
trước thì sẽ return và kết thúc hàm mà không gọi đóng file.Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Input your email to receive reset password link, or if you remember your password, you can click