Eric Niebler - Working with Asynchrony Generally and AMA at CppEurope 2022

แชร์
ฝัง
  • เผยแพร่เมื่อ 2 ธ.ค. 2024

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

  • @thomasziereis330
    @thomasziereis330 ปีที่แล้ว +2

    This talk finally made me understand the whole thing a little bit more. Thanks

  • @ZDima749
    @ZDima749 ปีที่แล้ว +2

    Thank you Eric, that was awesome! It's better to do a single time then hear 100 times :)
    The only thing, please update the pop_front() function to update the "tail". Otherwise, push_back() will stop working if all tasks were done once.

    • @EricNiebler
      @EricNiebler ปีที่แล้ว +1

      You're right, push_back() wasn't updating the tail. Oops!

    • @theintjengineer
      @theintjengineer ปีที่แล้ว

      What would it look like then? | Which line should be added/modified? Thank you.

    • @aharrison24
      @aharrison24 ปีที่แล้ว +2

      I think the problem is that when you pop the last element in the list, the tail pointer will still be pointing at that last element. So you need to detect that case and update tail to point at the head node. Something like: task* front = std::exchange(head.next, head.next->next); if (front == tail) { tail = &head; } return front;