From Functions to CoroutinesFrom Functions to Coroutines 40 Years Evolution Rainer Grimm Training, Coaching, and Technology Consulting www.ModernesCpp.netEvolution of Callable templateT invoke(Func 0 码力 | 29 页 | 510.47 KB | 6 月前3
Deciphering C++ Coroutines2/55 Deciphering Coroutines - Part 2 Mastering Asynchronous Control Flow Andreas Weis CppCon 20243/55 About me - Andreas Weis (he/him) ComicSansMS cpp@andreas-weis.net Co-organizer of the Munich best-practice talk.16/55 A mental model for coroutines: Cooperative Threads void spawn_task () { // ... Result r = outer_function (); }16/55 A mental model for coroutines: Cooperative Threads void spawn_task mental model for coroutines: Cooperative Threads PartialResult middle_function () { auto r = inner_function (); return PartialResult :: from_io_result (r); }16/55 A mental model for coroutines: Cooperative0 码力 | 156 页 | 1.79 MB | 6 月前3
Coroutines and Structured Concurrency in PracticeChallenges when onboarding coroutines A lot of existing code mostly callback-based A custom-built I/O event loop predates Asio by a decade fine-tuned for specific use cases Somewhat conservative conservative audience real benefit needs to be demonstrated to justify switchingCallbacks vs coroutines // read length auto len = make_unique(); async_read(socket, buffer(len.get(), sizeof(int32_t)) use_awaitable); // ...handle data... Local variable Manual lifetime managementCallbacks vs coroutines // read length auto len = make_unique (); async_read(socket, buffer(len.get(), sizeof(int32_t)) 0 码力 | 103 页 | 1.98 MB | 6 月前3
How Meta Made Debugging Async Code Easier with Coroutines and Senders0 码力 | 131 页 | 907.41 KB | 6 月前3
Behavioral Modeling in HW/SW Co-design Using C++ CoroutinesJeffrey E. Erickson cppcon 2023 1cppcon 2023 Behavioral Modeling in HW/SW Co-design using C++ coroutines Jeffrey E Erickson, Ph.D. Sebastian Schönberg, Ph.D.© 2023 Intel Corporation and Jeffrey E. Erickson Jeffrey E. Erickson cppcon 2023 8 Coroutines are an enabling language feature • To date, coroutines have been about execution and workloads • In the modeling context, coroutines… • Provide syntactic sugar Handle parallelism in a way that isn’t clunky • Scale across large and complex HW interactions But, coroutines lack comprehensive standard library support • We used concurrencppIntel Confidential Department0 码力 | 44 页 | 584.69 KB | 6 月前3
Coroutine Patterns and How to Use Them: Problems and Solutions Using Coroutines in a Modern Codebaseknowledge Francesco Zoffoli - Coroutine Patterns and How to Use Them - CppCon 2023 5Motivation Coroutines introduce new paradigm Francesco Zoffoli - Coroutine Patterns and How to Use Them - CppCon 2023 CppCon 2023 11Overview – Executor • Executes synchronous functions • Could be multi-threaded • Coroutines are split in synchronous functions Francesco Zoffoli - Coroutine Patterns and How to Use Them CppCon 2023 19 [1] https://ericniebler.com/2020/11/08/structured-concurrency/Lifetime Member coroutines implicitly capture this Francesco Zoffoli - Coroutine Patterns and How to Use Them - CppCon0 码力 | 70 页 | 1.45 MB | 6 月前3
Tornado 6.5 Documentationnetworking . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 102 6.5 Coroutines and concurrency . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 http_client = AsyncHTTPClient() response = yield http_client.fetch(url) raise gen.Return(response.body) Coroutines are a little magical, but what they do internally is something like this: from tornado.concurrent the fetch is done. This is what makes coroutines asynchronous. Anything you can do with coroutines you can also do by passing callback objects around, but coroutines provide an important simplification0 码力 | 272 页 | 1.12 MB | 3 月前3
Tornado 6.5 Documentationorg/projects/tornado/downloads/]. User’s guide Introduction Asynchronous and non-Blocking I/O Coroutines Queue example - a concurrent web spider Structure of a Tornado web application Templates and UI IOStream-based TCP server Coroutines and concurrency tornado.gen — Generator-based coroutines tornado.locks – Synchronization primitives tornado.queues – Queues for coroutines tornado.process — Utilities Introduction Asynchronous and non-Blocking I/O Blocking Asynchronous Examples Coroutines Native vs decorated coroutines How it works How to call a coroutine Coroutine patterns Calling blocking functions0 码力 | 437 页 | 405.14 KB | 3 月前3
Combining Co-Routines and Functions into a Job System(*function)() • struct Function{}: std::function, thread, type and id for logging • Tags • Coroutines of type Coro • Thread, type and id with operator() • std::tuple and std::vector containing and Functions into a Job System - CppCon 2021 18 / 39 Coroutines • Normal functions (synchronous) • Stack frame • Gone after return • Coroutines (asynchronous) can • Suspend to wait for a result, resume Hlavacs – Combining Co-Routines and Functions into a Job System - CppCon 2021 20 / 39 Coroutines in VGJS • Coroutines are created by calling them Coro retObj = driver(13); //create coro fr, return 0 码力 | 39 页 | 1.23 MB | 6 月前3
Working with Asynchrony Generically: A Tour of C++ ExecutorsUnder the hood of a concurrent operation 5. Implementing a simple algorithm 6. Senders and coroutines Part 2: 1. Structured concurrency 2. Cancellation 3. An extended example3 GOALS FOR THE EXECUTORS of abstractions (aka, concepts) derived from the algorithms • Efficient interoperability with coroutines • An open and extensible way to specify where, how, and when work should happen … including some async algorithms: • E.g., then, when_all, sync_wait, let_* • Utilities for integration with C++20 coroutines5 Example 1: Launching concurrent work6 EXAMPLE: LAUNCHING CONCURRENT WORK namespace ex = std::execution;0 码力 | 121 页 | 7.73 MB | 6 月前3
共 67 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
相关搜索词
FromFunctionstoCoroutinesDecipheringC++andStructuredConcurrencyinPracticeHowMetaMadeDebuggingAsyncCodeEasierwithSendersBehavioralModelingHWSWCodesignUsingCoroutinePatternsUseThemProblemsSolutionsModernCodebaseTornado6.5DocumentationCombiningRoutinesintoJobSystemWorkingAsynchronyGenericallyTourofExecutors













