Ultimate Guide on Synchronized Concurrency and Thread-safety with Kotlin Mutex 🟠
ฝัง
- เผยแพร่เมื่อ 29 มิ.ย. 2024
- 🏆 My Online Courses
stevdza-san.com
🎓Learn with Quizzes
play.google.com/store/apps/de...
☕ 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
Great video! Thanks for introducing these not so commonly talked about topics. Much appreciated!
Very well explained especially using examples related to jetpack compose. Thank you.
Beautifully explained and extremely important when working with coroutines.Thanks!
@@skarloti Thank you kindly 🙏💪
Please make a video on media 3 exo player with custom UI
Please, show how to integrate Apple Pay and Google Pay to Kotlin Multiplatform Project
I love this🎉
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 !
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. 👍
@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 😁
@@nathanaelheitz6951 You can use your viewmodel's onClear() function to observe when it's getting dispossed.
please make video on koin ktor kmp
@@RashidSoftfruit I have that in my notes! 👋
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?
Nice Topic and i liked the bathroom example ^_^
but what about this :
ReentrantLock is generally considered a better choice than a custom Mutex ?
Thanks!
8:42 repeat(times = 3) // spend 3x500 =-500 OK
The current balance was 1000. 😃
@@StevdzaSan 1000-3х500=-500 ?!
@@StevdzaSan I apologize. I missed seeing the positive balance check. You have the right. You have captured the occasion perfectly.