Actor Reentrancy in Swift explained

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

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

  • @paccini1
    @paccini1 3 месяца назад +2

    Great explanation and good catch about Actor reentrancy.

  • @srinivasanmunna
    @srinivasanmunna 7 месяцев назад +3

    This is a great one. I was actually expecting to see another dictionary variable that keeps track of running tasks. But the enum with associated type looks so much better.

  • @AcidUser
    @AcidUser 2 месяца назад

    Really good example, thank you! I learned a lot and think more in this new async/await way now instead of thinking in queues 😁

  • @michaellatta
    @michaellatta 2 месяца назад

    I avoided actors at the beginning because they were repentant in ways that broke my mental model. After watching apple’s concurrency video with the islands several times the phrase that clicked was that the serialization mechanism was tasks. So, rather than doing complex threading models or queuing work to run in the background I just create tasks from the UI and call actor methods for background work. This usage reduces the reentrancy issues as the control flow is in single tasks. If I need to spawn long running background tasks (detached) this will again raise the reentrancy issues.

  • @JumpingCow
    @JumpingCow 7 месяцев назад +1

    Subtle and complex! Thank you.

  • @andreypopov6166
    @andreypopov6166 Месяц назад

    Thank you for the great explanation. Another example that Swift concurrency should be used sparingly and designed properly, supplied with comment to explain "what is going on" without the believes that "this is just amazing and compiler will solve everything". By the way: "Doing one thing at a time but not atomically" should be printed on a t-shirt :) I am wondering what if an actor contain just private cache, async getter to read from the cache and sync setter to write to the cahe, will it behave as an atomic storage?

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

    Great content here. Thanks for sharing. this trick actually applies to a lot of problems.

  • @0xifarouk
    @0xifarouk 7 месяцев назад +1

    This is amazing, thank you for the explanation 🙏🏻
    Can we have a video on task cancellation please?

  • @filmaniac1984
    @filmaniac1984 7 месяцев назад

    Thanks @DonnyWalsdev! Great example and well explained.