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

ความคิดเห็น • 21

  • @ShubhamSinghMusic
    @ShubhamSinghMusic 5 วันที่ผ่านมา +4

    Great video! Thanks for introducing these not so commonly talked about topics. Much appreciated!

  • @vengateshm2122
    @vengateshm2122 5 วันที่ผ่านมา +3

    Very well explained especially using examples related to jetpack compose. Thank you.

  • @skarloti
    @skarloti 5 วันที่ผ่านมา +1

    Beautifully explained and extremely important when working with coroutines.Thanks!

    • @StevdzaSan
      @StevdzaSan  5 วันที่ผ่านมา

      @@skarloti Thank you kindly 🙏💪

  • @ayushverma2166
    @ayushverma2166 5 วันที่ผ่านมา +5

    Please make a video on media 3 exo player with custom UI

  • @amirfarkhadov5926
    @amirfarkhadov5926 5 วันที่ผ่านมา +2

    Please, show how to integrate Apple Pay and Google Pay to Kotlin Multiplatform Project

  • @jackeblan
    @jackeblan 5 วันที่ผ่านมา +1

    I love this🎉

  • @nathanaelheitz6951
    @nathanaelheitz6951 5 วันที่ผ่านมา +1

    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  4 วันที่ผ่านมา

      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 4 วันที่ผ่านมา

      @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  4 วันที่ผ่านมา +1

      @@nathanaelheitz6951 You can use your viewmodel's onClear() function to observe when it's getting dispossed.

  • @RashidSoftfruit
    @RashidSoftfruit 5 วันที่ผ่านมา +2

    please make video on koin ktor kmp

    • @StevdzaSan
      @StevdzaSan  5 วันที่ผ่านมา +3

      @@RashidSoftfruit I have that in my notes! 👋

  • @sayantanrc6194
    @sayantanrc6194 3 วันที่ผ่านมา

    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?

  • @heshamabdo6024
    @heshamabdo6024 5 วันที่ผ่านมา

    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  5 วันที่ผ่านมา

      Thanks!

  • @skarloti
    @skarloti 5 วันที่ผ่านมา

    8:42 repeat(times = 3) // spend 3x500 =-500 OK

    • @StevdzaSan
      @StevdzaSan  5 วันที่ผ่านมา

      The current balance was 1000. 😃

    • @skarloti
      @skarloti 5 วันที่ผ่านมา

      @@StevdzaSan 1000-3х500=-500 ?!

    • @skarloti
      @skarloti 5 วันที่ผ่านมา

      @@StevdzaSan I apologize. I missed seeing the positive balance check. You have the right. You have captured the occasion perfectly.