Preventing deadlock with std::lock_guard in modern C++ | Introduction to Concurrency in Cpp

Поделиться
HTML-код
  • Опубликовано: 5 окт 2024

Комментарии • 21

  • @anilzeybek
    @anilzeybek 2 года назад +11

    best series on c++ concurrent programming

    • @MikeShah
      @MikeShah  2 года назад +2

      Cheers, thank you for the kind words!

  • @monikaklein222
    @monikaklein222 3 месяца назад +1

    Thank you for explaining these concepts in such a clear way! I have watched other videos as well but yours are the best.

    • @MikeShah
      @MikeShah  3 месяца назад

      Cheers, you are most welcome!

  • @thestarinthesky_
    @thestarinthesky_ Год назад +3

    Great series on C++ Concurrent ! I was wondering if you're going to make some videos on atomic operations and recursive lock.

    • @MikeShah
      @MikeShah  Год назад +1

      Cheers, thank you for the kind words! I will make a note for the future!

  • @harishrawat1205
    @harishrawat1205 4 месяца назад

    Clear explanation! Really appreciate your efforts ✌️

  • @yashesvi-raina
    @yashesvi-raina 2 года назад +2

    i'm really enjoying these videos :p

  • @sinaezar5402
    @sinaezar5402 11 месяцев назад +1

    Hi, I wanted to say great videos, simple and clear explanation. a question if lock_guard do the lock and unlock automatically within the scope what would happen if in that scope we don't want some variables to be locked or unlocked (for non-shared data)?

    • @MikeShah
      @MikeShah  11 месяцев назад

      You could create a scope within the function. e.g.
      void do_something(){
      int unprotected;
      { // critical section here is protected in this block-scope
      std::lock_guard lock(some_mutex);
      }
      }

  • @srikarv4358
    @srikarv4358 Год назад +2

    Nice explanation, but audio is not smooth.

  • @jafeta.7553
    @jafeta.7553 2 дня назад

    Great video!

  • @pavank2705
    @pavank2705 Год назад

    clicked pause button at first :D :D😅😅, Great video

    • @MikeShah
      @MikeShah  Год назад

      Hehe 😃

    • @pavank2705
      @pavank2705 Год назад

      Thanks for videos sir, very helpful

    • @MikeShah
      @MikeShah  Год назад

      @@pavank2705 Cheers!

  • @greg77389
    @greg77389 8 месяцев назад

    In your example you could have just unlocked the lock in a "finally" block...

    • @MikeShah
      @MikeShah  8 месяцев назад

      C++ does not have 'finally' officially. There may be extensions (learn.microsoft.com/en-us/cpp/cpp/try-finally-statement?view=msvc-170) available in some compilers, but C++ instead uses RAII and the destructor will be called.