CppCon 2016: Michael Caisse “Asynchronous IO with Boost.Asio"

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

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

  • @JosueAndradeGomes
    @JosueAndradeGomes 8 ปีที่แล้ว +24

    Best Cppcon 2016 talk. Useful stuff and tips. ASIO and coroutines, state machines and Spirit all deserve their own talk, maybe next year?

  • @draguin
    @draguin 8 ปีที่แล้ว +17

    I loved the talk. Especially the very nice and enlightning story.
    That said, I find fairly confusing the way read/write operations are tasks that you enqueue and are each executed once, and lead to this weird "recursive enqueueing" pattern, that I personally find error prone, and quite unintuitive with added issues like lifetimes management problems.
    Maybe I'm juste naive, but when I think of a server, I just want to have a callback when something have been read (and the server reads continuously without me doing anything about this), and have a write() operation, that may be asynchronous.

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

      nope. same here. (but i just know a few c++).
      great story to illustrate the concepts. then c++ code ruined the story lol : )

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

      You can totally do that. But in that architecture you would need something to manage lifetime of one connection (socket in the handler). By using shared_ptr and enable_shared_from_this you can hide that management layer. It's neat :)

  • @PaweSkalczynski
    @PaweSkalczynski 7 ปีที่แล้ว +5

    I want that Asio+MSM+Spirit talk , please ! :)

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

    Great lecture. I wish I watched it few years ago instead of going thru the docs.

  • @shushens
    @shushens 6 ปีที่แล้ว +18

    It is getting on my nerves that every ASIO example out there is showcasing a TCP server. Is there nothing else people do with ASIO?

    • @marc2377
      @marc2377 5 ปีที่แล้ว +3

      Indeed.

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

      I know right?! I'm trying to implement asio with a little home built audio synth. But I'm still quite a novice and not sure where to start. I have a situation where the synth produces at a certain rate, and the endpoint consumes at a certain rate that do not match.... I'd like to take advantage of free time during endpoint's buffer consumption to produce more sound w/FX processing etc...

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

      @@kb3khs First, create an abstract model of program/data flow independent of your programming language/libraries. Then, start with C and do some small experiments with read()/write(),epoll() calls and maybe threads to get an overview how things work under the hood and how asio is different from sync. io/threads with locks.
      Then you can go back at your abstract design and decide if you want to go for asio or something different.

  • @dunga309
    @dunga309 3 หลายเดือนก่อน

    JC! Isn't Asio enough complicated to complicate it even more with butlers and family?

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

    The way he his storing the object in a shared pointer and keeping that in a lambda may be a memory leak.
    Unless you reset the shared pointer in the lambda body it will not get destroyed as a member variable and keep the object alive?
    Am I missing something?

  • @christopherogle5403
    @christopherogle5403 7 ปีที่แล้ว +6

    What is `auto ... vn` in the lambda arguments?

    • @sidasdf
      @sidasdf 5 หลายเดือนก่อน

      This the following are semantically equivalent:
      template
      void foo(Ts ... ts){}
      void foo(auto ... ts){}
      However, until C++20, it wasn't possible to write lamdbas with templated parameters, and so the rather unorthodox auto... syntax was used instead. Note how that I could get this behavior like follows:
      auto fn = [](Ts... vs)
      {};

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

    I am lookin for async_connect implementation with strands. If you call async_connect and immediatelly try to write, the way to force connect_handle earlier than the write error is quite not obvious...

  • @mwont
    @mwont 7 ปีที่แล้ว

    loved the talk

  • @GeorgePapageorgakis
    @GeorgePapageorgakis 7 ปีที่แล้ว +3

    Great info but all this it would be easier to explain with shapes and arrows...

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

    Can we access the slides somewhere?

    • @TimBochenek
      @TimBochenek 6 ปีที่แล้ว +3

      They are linked in the comments, indirectly, github.com/CppCon/CppCon2016/blob/master/Tutorials/Asynchronous%20IO%20with%20Boost.Asio/Asynchronous%20IO%20with%20Boost.Asio%20-%20Michael%20Caisse%20-%20CppCon%202016.pdf

  • @photoallergic
    @photoallergic 7 ปีที่แล้ว +3

    Great talk as expected, but the lambda at 58:19 is by far the ugliest rendition of code I have seen in a long time.

  • @gowrishankars9743
    @gowrishankars9743 2 ปีที่แล้ว

    Anybody knows how to use boost::asio just only to poll list of file descriptor ??

  • @Perpendikylyar
    @Perpendikylyar 4 ปีที่แล้ว

    What about file async i/o in POSIX?

    • @AntoineViallonDevelloper
      @AntoineViallonDevelloper 3 ปีที่แล้ว

      You wouldn't do it with ASIO. You can do it the exact same way you do it in C.

  • @meow75714
    @meow75714 6 ปีที่แล้ว +3

    amazing how geeks can tell really good jokes about slushies and butters but still keep a very straight face!