Ultimate Guide on Synchronized Concurrency and Thread-safety with Kotlin Mutex 🟠

  Рет қаралды 5,700

Stevdza-San

Stevdza-San

Күн бұрын

🏆 My Online Courses
stevdza-san.com
📝 Writing on Medium
/ stevdza-san
☕ Let's get a coffee. You're paying! :)
ko-fi.com/stevdza_san
💻 Github
github.com/stevdza-san
📸 Instagram
/ stevdza_san
⌚Timestamps
0:00 - Introduction
0:23 - About Mutex
4:18 - Counter Example
6:08 - AtomicInteger
6:32 - Exceptions
7:26 - Bank Example
9:34 - Singletons

Пікірлер: 27
@ShubhamSinghMusic
@ShubhamSinghMusic Ай бұрын
Great video! Thanks for introducing these not so commonly talked about topics. Much appreciated!
@MenaSamer
@MenaSamer Ай бұрын
Great and simple ... Also thanks for adding the part that related to the AtomicInt and Singleton ... Valued Video 👍👍
@vengateshm2122
@vengateshm2122 Ай бұрын
Very well explained especially using examples related to jetpack compose. Thank you.
@mohancena8970
@mohancena8970 24 күн бұрын
Thanks for uploading this video for not only focusing on Android concepts, need more kotlin essential videos. hats off keep rock 🫡🔥
@skarloti
@skarloti Ай бұрын
Beautifully explained and extremely important when working with coroutines.Thanks!
@StevdzaSan
@StevdzaSan Ай бұрын
@@skarloti Thank you kindly 🙏💪
@ayushverma2166
@ayushverma2166 Ай бұрын
Please make a video on media 3 exo player with custom UI
@arthurlr23
@arthurlr23 27 күн бұрын
I would love to see that too, especially regarding the new media sessions service
@jackeblan
@jackeblan Ай бұрын
I love this🎉
@amirfarkhadov5926
@amirfarkhadov5926 Ай бұрын
Please, show how to integrate Apple Pay and Google Pay to Kotlin Multiplatform Project
@jamesdavenavor6247
@jamesdavenavor6247 Ай бұрын
What happens if the same mutex lock was called inside a method that called the mutex lock?
@sayantanrc6194
@sayantanrc6194 Ай бұрын
At 10:42 inside the "synchronized" block, is it needed to have the "INSTANCE ?: " part? Because the null check is happening before the "synchronized" block anyway?
@MatthiasMeger
@MatthiasMeger 29 күн бұрын
Another thread could have created the instance in the meantime. Hence, it must be ensured only one instance is created by checking for null first.
@RashidSoftfruit
@RashidSoftfruit Ай бұрын
please make video on koin ktor kmp
@StevdzaSan
@StevdzaSan Ай бұрын
@@RashidSoftfruit I have that in my notes! 👋
@nathanaelheitz6951
@nathanaelheitz6951 Ай бұрын
Thanks for the video ! Clearly explained 😊 Could you please make a video in compose multiplatform with bottom navigation menu, that keeps states of each views that are inside the menu ? I have issues with that... when I switch from menu item A to B and I switch back to A, I loose state. I mention that I have a viewmodel for A and B, delivered by main component... so I don't understand :/ Thanks for help !
@StevdzaSan
@StevdzaSan Ай бұрын
Usually, a view model is used to preserve a state. You would have to debug your app to see what's going on. When I encounter an issue like that, i create a sample project and test that one feature in isolation separately. That way, it's easier to pinpoint what's going on. 👍
@nathanaelheitz6951
@nathanaelheitz6951 Ай бұрын
@StevdzaSan Thanka for answering! I tried to debug with the debugger :) My final question is : is it normal that the View A is refreshing when we're going back to it from View B ? Since when I add a breakpoint inside my LaunchEffect(Unit) in View A, it's triggered everytime we're going back to this view Is it normal? So in that case, is ViewModel used to restore state ? In my test, I passed as parameter the ViewModel that I didn't used voluntarily to see if the view is refreshing at going back. I have a button that increments a counter. Then, at going back it's going back to 0. So if I save that to the viewmodel, value is back again, but I'm persuaded that because I'm using a bottom navigation view, there is a way to preserve state. Maybe I'm wrong ! Thanks 😁
@StevdzaSan
@StevdzaSan Ай бұрын
@@nathanaelheitz6951 You can use your viewmodel's onClear() function to observe when it's getting dispossed.
@heshamabdo6024
@heshamabdo6024 Ай бұрын
Nice Topic and i liked the bathroom example ^_^ but what about this : ReentrantLock is generally considered a better choice than a custom Mutex ?
@StevdzaSan
@StevdzaSan Ай бұрын
Thanks!
@skarloti
@skarloti Ай бұрын
8:42 repeat(times = 3) // spend 3x500 =-500 OK
@StevdzaSan
@StevdzaSan Ай бұрын
The current balance was 1000. 😃
@skarloti
@skarloti Ай бұрын
@@StevdzaSan 1000-3х500=-500 ?!
@skarloti
@skarloti Ай бұрын
@@StevdzaSan I apologize. I missed seeing the positive balance check. You have the right. You have captured the occasion perfectly.
Return a value from a Kotlin Coroutine Scope - Explained
6:32
Stevdza-San
Рет қаралды 18 М.
Everything you need to know about Kotlin 2.0 🟣
11:05
Stevdza-San
Рет қаралды 62 М.
Они так быстро убрались!
01:00
Аришнев
Рет қаралды 2,2 МЛН
Smart Sigma Kid #funny #sigma #memes
00:26
CRAZY GREAPA
Рет қаралды 2,7 МЛН
Получилось у Миланы?😂
00:13
ХАБИБ
Рет қаралды 5 МЛН
Talos OS - Taking the Sting Out of Kubernetes Deployments
19:49
Jim's Garage
Рет қаралды 8 М.
Search View in Material 3 Android
9:43
Dev Atrii
Рет қаралды 1,3 М.
Kotlin Coroutines - What Are Coroutines? (Part 1)
8:19
Ahmed Guedmioui
Рет қаралды 2,5 М.
How principled coders outperform the competition
11:11
Coderized
Рет қаралды 1,6 МЛН
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 779 М.
Compose UI for... a Light Switch | Jake Wharton
47:02
Kotlin by JetBrains
Рет қаралды 11 М.
When RESTful architecture isn't enough...
21:02
Dreams of Code
Рет қаралды 265 М.