Aprenda Go 🇧🇷 Cap. 18 – Concorrência – 2. Goroutines & WaitGroups
Cap. 18 – Concorrência – 2. Goroutines & WaitGroups Transcript and Lesson Notes
- O código abaixo é linear. Como fazer as duas funções rodarem concorrentemente? - https://play.golang.org/p/XP-ZMeHUk4 - Goroutines! - O que são goroutines? São "threads." - O que são threads? [WP](https://pt.wikipedia.
Quick Summary
- O código abaixo é linear. Como fazer as duas funções rodarem concorrentemente? - https://play.golang.org/p/XP-ZMeHUk4 - Goroutines! - O que são goroutines? São "threads." - O que são threads? [WP](https://pt.wikipedia.
Key Takeaways
- Review the core idea: - O código abaixo é linear. Como fazer as duas funções rodarem concorrentemente? - https://play.golang.org/p/XP-ZMeHUk4 - Goroutines! - O que são goroutines? São "threads." - O que são threads? [WP](https://pt.wikipedia.
- Understand how golang fits into Cap. 18 – Concorrência – 2. Goroutines & WaitGroups.
- Understand how programação fits into Cap. 18 – Concorrência – 2. Goroutines & WaitGroups.
- Understand how go fits into Cap. 18 – Concorrência – 2. Goroutines & WaitGroups.
- Understand how programar fits into Cap. 18 – Concorrência – 2. Goroutines & WaitGroups.
Key Concepts
Full Transcript
- O código abaixo é linear. Como fazer as duas funções rodarem concorrentemente? - https://play.golang.org/p/XP-ZMeHUk4 - Goroutines! - O que são goroutines? São "threads." - O que são threads? [WP](https://pt.wikipedia.org/wiki/Thread_(ci%C3%AAncia_da_computa%C3%A7%C3%A3o)) - Na prática: go func. - Exemplo: código termina antes da go func executar. - Ou seja, precisamos de uma maneira pra "sincronizar" isso. - Ah, mas então... não. - Qualé então? sync.WaitGroup: - Um WaitGroup serve para esperar que uma coleção de goroutines termine sua execução. - func Add: "Quantas goroutines?" - func Done: "Deu!" - func Wait: "Espera todo mundo terminar." - Ah, mas então... sim! - Só pra ver: runtime.NumCPU() & runtime.NumGoroutine() - Go Playground: https://play.golang.org/p/8iiqLX4sWc
Lesson FAQs
What is Cap. 18 – Concorrência – 2. Goroutines & WaitGroups about?
- O código abaixo é linear. Como fazer as duas funções rodarem concorrentemente? - https://play.golang.org/p/XP-ZMeHUk4 - Goroutines! - O que são goroutines? São "threads." - O que são threads? [WP](https://pt.wikipedia.
What key concepts are covered in this lesson?
The lesson covers golang, programação, go, programar, programacao.
What should I learn before Cap. 18 – Concorrência – 2. Goroutines & WaitGroups?
Review the previous lessons in Aprenda Go 🇧🇷, then use the transcript and key concepts on this page to fill any gaps.
How can I practice after this lesson?
Practice by applying the main concepts: golang, programação, go, programar.
Does this lesson include a transcript?
Yes. The full transcript is visible on this page in indexable HTML sections.
Is this lesson free?
Yes. CourseHive lessons and courses are available to learn online for free.
