Wait groups in golang

  Рет қаралды 24,358

Hitesh Choudhary

Hitesh Choudhary

2 жыл бұрын

Welcome to a youtube channel dedicated to programming and coding related tutorials. We talk about tech, write code, discuss about cloud and devops. That’s what we do all day, all year. We roll out a lot of series and videos on our channel.
All the learning resources such as code files, documentations, articles and community discussions are available on our website:
chaicode.com/
You can find our discord link, github link etc on the above website.
Twitter/X link: x.com/hiteshdotcom
Discord link: hitesh.ai/discord
Learn React with 10 projects: • Let's learn react from...
Learn Docker: • A practical guide on D...
Learn Kubernetes: • Complete Kubernetes Co...
How does a browser works: • How does a browser wor...
How nodejs works: • How node JS works | En...
Learn Redux-toolkit: • Learn Redux Toolkit in...
Learn NextJS: • Nextjs Full stack course
Learn Typescript: • Why to learn Typescript
Learn Javascript: • Welcome to new JavaScr...
Learn React Native: • React Native Mastery: ...
Learn Zustand: • React state management...
Learn Golang: • How to get started wit...

Пікірлер: 19
@r00t_sh3ll
@r00t_sh3ll 2 жыл бұрын
Loving this series! Great work.
@74Bagas
@74Bagas 2 жыл бұрын
that gooogle though... oh my god, made my day. hahahha
@hiteshbhagwat8952
@hiteshbhagwat8952 2 жыл бұрын
Hi Hitesh really love yur videos sir 💝💝😊
@powpowson
@powpowson Жыл бұрын
Thanks for the video, I'm just now seeing the beauty in goroutines
@Randomguy48279xyz
@Randomguy48279xyz 2 жыл бұрын
👍
@omkesh12sajjanwar.22
@omkesh12sajjanwar.22 Жыл бұрын
Hey Could we call wg.Add(1) before go routine, in rear scenario there might chances to miss wg.Add() after goroutine spawn.
@abhinavkumar3751
@abhinavkumar3751 6 ай бұрын
Yeah we can do that, if you know you're going to have exactly 100 threads, then you can do wg.Add(100) at start.
@VarunSingh-cv4oi
@VarunSingh-cv4oi Жыл бұрын
what if we are not concernerd with result of go routine, do we still need to use wait?
@SagarKumar-yr4ky
@SagarKumar-yr4ky Жыл бұрын
Same question, let's say we fire multiple go routines in a for loop & we just want them to process something or do some CRUD operation in DB and we don't care about the result of the method called by these go routines, do we still need wait groups in that case too? I mean, CRUD operation will be executed in the background anyways right ?
@SanthoshM25
@SanthoshM25 Жыл бұрын
@@SagarKumar-yr4ky yes you will need wait groups in these scenarios too. Basically whenever you want all your go routines executions to be done/finish properly you have to use wait group. If you don't use wait group then the main process execution may end before the complete execution of go routine, so to keep the main process to wait for these go routines to complete their process we need to add wait group.
@soniapaul288
@soniapaul288 2 жыл бұрын
wg is a pointer variable but neither asterisk (*) nor (&) is being used, why ?
@dhanushs1802
@dhanushs1802 2 жыл бұрын
we are making a copy of sync.WaitGroup by taking advantage of zero value in golang here. And we are not assigning anything to wg here after declaring it. We are just calling the relevant methods on it. So we don't have a need of pointers here isn't it.
@flexairz
@flexairz 2 жыл бұрын
Why did you remove my comment about the wg.Add(1) being in the wrong place? My Go did not accept that, so I wanted to help out.
@HiteshChoudharydotcom
@HiteshChoudharydotcom 2 жыл бұрын
I didn’t removed anything, your comments are landing in spam
@dhanushs1802
@dhanushs1802 2 жыл бұрын
Curious, where do you think is the right place to add? And why?
@satwikanandchauhan
@satwikanandchauhan 2 жыл бұрын
1st comment and like
@PikasoCapture
@PikasoCapture Жыл бұрын
okay
@debankanmitra2425
@debankanmitra2425 Жыл бұрын
That doesn't seems to be faster , i expect it to be more faster
@codeunited5905
@codeunited5905 Жыл бұрын
i measured the time taken to send requests synchronously and concurrently. The concurrent way was 2.1x faster than synchronous way.
Mutex in golang
5:41
Hitesh Choudhary
Рет қаралды 24 М.
Channels and Deadlock in golang
18:39
Hitesh Choudhary
Рет қаралды 23 М.
Эффект Карбонаро и нестандартная коробка
01:00
История одного вокалиста
Рет қаралды 10 МЛН
A little girl was shy at her first ballet lesson #shorts
00:35
Fabiosa Animated
Рет қаралды 15 МЛН
Iron Chin ✅ Isaih made this look too easy
00:13
Power Slap
Рет қаралды 36 МЛН
Pleased the disabled person! #shorts
00:43
Dimon Markov
Рет қаралды 29 МЛН
Golang Channels Or Wait Groups? Let Me Explain.
18:32
Anthony GG
Рет қаралды 20 М.
Goroutines Crash Course (Mutex, Channels, Wait Group, & More!)
15:42
A long video on MOD in golang
27:16
Hitesh Choudhary
Рет қаралды 31 М.
Master Golang with Interfaces
21:54
Kantan Coding
Рет қаралды 10 М.
Чистая архитектура проекта на Golang
58:22
Олег Козырев
Рет қаралды 38 М.
Concurrency in Go
18:40
Jake Wright
Рет қаралды 611 М.
This Is The BEST Way To Structure Your GO Projects
11:08
Melkey
Рет қаралды 68 М.
Race Condition in golang
18:46
Hitesh Choudhary
Рет қаралды 19 М.
Go vs Rust: Which To Learn In 2024?
6:27
Kodaps Academy
Рет қаралды 149 М.
8 Товаров с Алиэкспресс, о которых ты мог и не знать!
49:47
РасПаковка ДваПаковка
Рет қаралды 171 М.
АЙФОН 20 С ФУНКЦИЕЙ ВИДЕНИЯ ОГНЯ
0:59
КиноХост
Рет қаралды 1,2 МЛН
Как бесплатно замутить iphone 15 pro max
0:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 8 МЛН
Лучший браузер!
0:27
Honey Montana
Рет қаралды 948 М.
Как удвоить напряжение? #электроника #умножитель
1:00
Hi Dev! – Электроника
Рет қаралды 1,1 МЛН