{"id":457267,"date":"2025-04-24T15:01:19","date_gmt":"2025-04-24T15:01:19","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=457267"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2025-04-24T15:01:19","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=457267","title":{"rendered":"<span>Senders\/Receivers \u0432 C++26: \u043e\u0442 \u0442\u0435\u043e\u0440\u0438\u0438 \u043a \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u043c\u044b \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434: \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0411\u0414, UI-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430, \u0444\u043e\u043d\u043e\u0432\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u2014 std::thread, std::async, std::future \u2014 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u044e\u0442 boilerplate, \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u043d\u043d\u044b\u0435 try\/catch, \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u043e\u0442\u043c\u0435\u043d\u0443 \u0438 \u00abcallback hell\u00bb.<\/p>\n<p>\u0412\u0437\u0430\u043c\u0435\u043d \u044d\u0442\u043e\u0433\u043e C++26 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c <strong>Senders\/Receivers<\/strong> \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 <code>&lt;execution&gt;<\/code>, \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u0443\u044e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0441 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u043c \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 <code>policy_aware_scheduler<\/code>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>\u0415\u0434\u0438\u043d\u044b\u0439 API \u0434\u043b\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438 \u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430, \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u044e\u0449\u0438\u0439 \u00abcallback-hell\u00bb \u0438 \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u043e\u0441\u0442\u044c <code>std::future\/std::async<\/code> <\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u044b (<code>| then | when_all | upon_error<\/code>), \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0433\u0438\u0431\u043a\u0438\u0435 DAG(Directed Acyclic Graph) \u0437\u0430\u0434\u0430\u0447\u0438<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043e\u0442\u043c\u0435\u043d\u044b \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043e\u0448\u0438\u0431\u043e\u043a \u043a\u0430\u043a \u043d\u0435\u043e\u0442\u044a\u0435\u043c\u043b\u0435\u043c\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430 (<code>set_stopped, upon_error<\/code>) <\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u0440\u0443\u0442\u0438\u043d (<code>co_await<\/code><strong> <\/strong>sender) \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 scheduler \u0432 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b (<code>std::for_each<\/code>)<\/p>\n<\/li>\n<\/ul>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u044f\u0449\u0438\u043c\u0438 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f\u043c\u0438, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435:<\/p>\n<ul>\n<li>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0442\u0440\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438: <strong>Scheduler<\/strong>, <strong>Sender<\/strong>, <strong>Receiver<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e\u0431 \u0438\u043d\u0441\u043f\u0435\u043a\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 (<code>completion_signatures_of_t<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 <code>tag_invoke<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043c \u0432\u0441\u0451 \u044d\u0442\u043e \u0432 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0441 NVIDIA stdexec.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/78a\/6aa\/32c\/78a6aa32ceb8d17b57921924ec7e02e8.png\" width=\"1536\" height=\"1024\" sizes=\"auto, (max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/getpro\/habr\/upload_files\/78a\/6aa\/32c\/78a6aa32ceb8d17b57921924ec7e02e8.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/78a\/6aa\/32c\/78a6aa32ceb8d17b57921924ec7e02e8.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/figure>\n<hr\/>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0438 \u0435\u0434\u0438\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434?<\/h3>\n<p>\u041f\u043e\u043f\u044b\u0442\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u0432 C++ \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u044c \u0434\u0430\u0432\u043d\u043e \u2014 \u0438 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0434\u0430\u0447\u043d\u043e. \u0414\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f Senders\/Receivers \u0421++ \u043e\u043f\u0438\u0440\u0430\u043b\u0441\u044f \u043d\u0430 \u0442\u0430\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u0430\u043a <code>std::async<\/code>, <code>std::future<\/code>, Boost.Asio \u0438 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b <code>co_await<\/code>. \u041e\u043d\u0438 \u043f\u043e\u043c\u043e\u0433\u0430\u043b\u0438 \u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u043d\u043e \u043f\u043e \u043c\u0435\u0440\u0435 \u0440\u043e\u0441\u0442\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438\u0441\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u043c\u0435\u0448\u0430\u044e\u0449\u0438\u0435 \u0438\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p>\u041f\u043e\u044f\u0432\u0438\u0432\u0448\u0438\u0441\u044c \u0432 C++11, <code>std::async<\/code> \u0438 <code>std::future<\/code> \u0441\u0442\u0430\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u043a \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u0441\u0432\u043e\u044e \u043d\u0435\u0441\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445:<\/p>\n<ul>\n<li>\n<p>\u041d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>get()<\/code> \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p>E\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u0443\u0436\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u2014 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0451 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043e\u0442\u043c\u0435\u043d\u044b;<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430\u043c\u0438 \u0438 I\/O: \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u0434\u0430\u0442\u044c, \u0433\u0434\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443, \u0438\u043b\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430;<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a, \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <code>future::get()<\/code>, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0445\u0430\u043e\u0441 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0431\u0435\u0437 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0418, \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0435\u0449\u0435 \u0434\u043e\u043b\u0433\u043e, \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u044f\u0441\u044c \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438&#8230;<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u043e\u0442 \u0436\u0435 Boost.Asio \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u043b \u0432\u044b\u0441\u043e\u0447\u0430\u0439\u0448\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 I\/O, \u043d\u043e \u0440\u0430\u0441\u043f\u043b\u0430\u0442\u043e\u0439 \u0437\u0430 \u044d\u0442\u043e \u0441\u0442\u0430\u043b\u0430 \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0438\u0437\u043a\u0430\u044f \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c. \u041a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043b\u044f\u043c\u0431\u0434\u044b \u2014 \u043e\u0442\u0441\u044e\u0434\u0430 \u0438 &#171;callback hell&#187;. \u042d\u0442\u043e \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u044f\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443, \u043d\u043e \u0438 \u043b\u044e\u0431\u0443\u044e \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e:<\/p>\n<pre><code class=\"cpp\">async_read(..., [&amp;](...) {   async_write(..., [&amp;](...) {     async_timer(..., [&amp;](...) {       \/\/ \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u043d\u043e     });   }); });<\/code><\/pre>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0438 (\u043e\u0448\u0438\u0431\u043a\u0438, \u043e\u0442\u043c\u0435\u043d\u0430, \u0441\u0431\u043e\u0438) \u043f\u0435\u0440\u0435\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u043b\u0435\u0447\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 (\u043d\u0430\u0434\u0435\u0436\u043d\u043e, \u043a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0432 C++) .<\/p>\n<p>\u0421 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c <code>co_await<\/code> \u0432 C++20 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043d\u0430\u0434\u0435\u0436\u0434\u0430 \u2014 \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c \u0432\u0435\u0440\u043d\u0443\u043b\u0441\u044f \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. \u041d\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b: \u043d\u0435 \u0443\u043c\u0435\u044e\u0442 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e &#171;\u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c&#187; <code>std::future<\/code> \u0438\u043b\u0438 <code>asio::awaitable<\/code>; \u043d\u0435 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b; \u043d\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441 <code>scheduler<\/code> \u0438\u043b\u0438 I\/O \u0431\u0435\u0437 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u043e\u0432; \u0438\u043c\u0435\u044e\u0442 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 lifetime \u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0438 \u043e\u0442\u043c\u0435\u043d\u044b.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 Senders\/Receivers &#8212; \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u044c \u0438 \u0440\u0430\u0437\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043a \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0432 C++, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0445 \u0432 \u0435\u0434\u0438\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0443\u044e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0433\u043e embedded-\u043a\u043e\u0434\u0430 \u0434\u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 GPU-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<hr\/>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 Senders\/Receivers (\u0441 \u0447\u0435\u0433\u043e \u0432\u0441\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f)<\/h3>\n<p>\u041d\u043e\u0432\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0430\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0442\u0440\u0451\u0445 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f\u0445:<\/p>\n<p><strong>1) Scheduler<\/strong> \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 <em>\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442<\/em> \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (thread-pool, inline, I\/O-\u0440\u0435\u0430\u043a\u0442\u043e\u0440) \u0431\u0435\u0437 \u0436\u0451\u0441\u0442\u043a\u043e\u0439 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p><code>inline_scheduler<\/code> \u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0441\u0440\u0430\u0437\u0443,<\/p>\n<\/li>\n<li>\n<p><code>static_thread_pool::scheduler<\/code> \u0438\u0437 NVIDIA stdexec,<\/p>\n<\/li>\n<li>\n<p><code>reactor_scheduler<\/code> (I\/O \u043d\u0430 <code>io_uring<\/code>),<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e \u0445\u0430\u0431\u0430\u043c \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u043d\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 GPU\/GUI schedulers.<\/p>\n<\/li>\n<\/ul>\n<p><strong>2) Sender<\/strong> \u2014 \u043b\u0435\u043d\u0438\u0432\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u041e\u043d <strong>\u043d\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442<\/strong> \u0440\u0430\u0431\u043e\u0442\u0443, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0438\u043b\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0443:<\/p>\n<ul>\n<li>\n<p><strong>Single-value senders<\/strong>: <code>sync_wait<\/code>, <code>just<\/code>, <code>then<\/code>, <code>co_await sender<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>Multi-value senders<\/strong>: <code>when_all<\/code>, <code>when_any<\/code>, <code>when_all_range<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u0417\u0430 \u043a\u0443\u043b\u0438\u0441\u0430\u043c\u0438 Senders\/Receivers \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0434\u0432\u0430 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 CPO (\u0440\u0430\u0432\u043d\u043e \u043a\u0430\u043a \u0438 \u0432 coroutine interop (<a href=\"https:\/\/open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2024\/p3109r0.html\" rel=\"noopener noreferrer nofollow\">&#171;P3109R0&#187;<\/a>)):<\/p>\n<ul>\n<li>\n<p><code><strong>std::execution::connect(Sender, Receiver)<\/strong><\/code> \u2014 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 sender \u0438 receiver, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u00aboperation state\u00bb (\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438) \u0431\u0435\u0437 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/p>\n<\/li>\n<li>\n<p><code><strong>std::execution::start(OperationState&amp;)<\/strong><\/code> \u2014 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0443\u0436\u0435 \u0441\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e, \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044f \u0435\u0451 \u0432 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043c\u0435\u043b\u043e \u043e\u0442\u043b\u043e\u0436\u0438\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u043e \u043f\u043e\u043b\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0438 \u0433\u0440\u0430\u0444\u0430 \u0437\u0430\u0434\u0430\u0447, \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0438 (\u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 operation state) \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043e\u0442\u043c\u0435\u043d\u0443 (\u0447\u0435\u0440\u0435\u0437 <code>get_stop_token<\/code>) \u0434\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u0442\u0430. <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u0432\u0441\u0451 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u043e\u0441\u044c \u0441\u0440\u0430\u0437\u0443, \u043c\u044b \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0438 \u0431\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u043e\u0442\u043c\u0435\u043d\u043e\u0439 \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 senders \u0432 DAG.<\/p>\n<p><strong>3) Receiver<\/strong> \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u043b\u0431\u044d\u043a \u0441 \u0442\u0440\u0435\u043c\u044f \u043a\u0430\u043d\u0430\u043b\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\n<p><code>set_value(v\u2026)<\/code> \u043f\u0440\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435,<\/p>\n<\/li>\n<li>\n<p><code>set_error(exception_ptr)<\/code> \u043f\u0440\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438,<\/p>\n<\/li>\n<li>\n<p><code>set_stopped()<\/code> \u043f\u0440\u0438 \u043e\u0442\u043c\u0435\u043d\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418, \u043a\u0443\u0434\u0430 \u0436\u0435 \u0431\u0435\u0437 \u043d\u0438\u0445, \u0440\u0430\u0437\u043d\u044b\u0435 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><code><strong>just(v\u2026)<\/strong><\/code> \u0441\u043e\u0437\u0434\u0430\u0451\u0442 sender, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u0434\u0430\u0451\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0435.<\/p>\n<\/li>\n<li>\n<p><code><strong>read_env(get_scheduler)<\/strong><\/code> \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 <code>scheduler<\/code> \u0438\u0437 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><code><strong>then(sender, func)<\/strong><\/code> \u2014 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 sender (\u043c\u043e\u0436\u043d\u043e \u0438 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0430) \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u0438\u043b\u0438 tuple \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439), \u0438 \u0437\u0430\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043d\u043e\u0432\u044b\u0439 sender (\u0435\u0441\u043b\u0438 \u0437\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u044f\u0434 &#8212; \u0431\u0443\u0434\u0435\u0442 sender&lt;sender&lt;int&gt;&gt; \u0438 \u0442.\u0434. :<\/p>\n<p>auto s = just( 10 ) | then( []( int x ) { return x * 2; } ); &#8212; \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440<\/p>\n<\/li>\n<li>\n<p><code><strong>let_value(sender, func)<\/strong><\/code> \u2014 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <em>sender, \u043d\u043e \u043d\u0435 \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c<\/em>. \u0422\u0440\u0435\u0431\u0443\u0435\u0442, \u0447\u0442\u043e\u0431\u044b <code><strong>func<\/strong><\/code><strong> <\/strong>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b<strong> <\/strong><code><strong>sender<\/strong><\/code>(\u0434\u0440\u0443\u0433\u0443\u044e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443), \u0438 \u00ab\u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u00bb \u0435\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044f \u0434\u0432\u0430 \u0448\u0430\u0433\u0430 \u0432 \u043e\u0434\u0438\u043d DAG-\u0443\u0437\u0435\u043b.<\/p>\n<\/li>\n<li>\n<p><code><strong>when_all(s1,s2,\u2026)<\/strong><\/code> \u2014 \u0436\u0434\u0451\u0442 \u0432\u0441\u0435\u0445 senders, \u043e\u0442\u0434\u0430\u0451\u0442 <code>set_value(v1,v2,\u2026)<\/code>.<\/p>\n<\/li>\n<li>\n<p><code><strong>when_any(s1,s2,\u2026)<\/strong><\/code> \u2014 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c.<\/p>\n<\/li>\n<li>\n<p><code><strong>when_all_range(container)<\/strong><\/code> \u2014 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 run-time \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e senders.<\/p>\n<\/li>\n<li>\n<p><code><strong>sync_wait<\/strong><\/code> &#8212; \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0437\u043e\u0432, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 <code>optional&lt;tuple&lt;...&gt;&gt;<\/code> (\u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435)<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e \u0445\u043e\u0434\u0443 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044f \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0414\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e NVIDIA <code>stdexec<\/code>, \u043f\u043e\u043a\u0430 <code>&lt;execution&gt;<\/code> \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 \u043c\u0430\u043b\u043e\u0433\u043e, \u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u0441\u043b\u043e\u0432\u0430 \u0432 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440:<\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt; #include &lt;stdexec\/execution.hpp&gt; #include &lt;string&gt;  namespace ex = stdexec;  int main() {    \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c sender \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c just, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \"Hello\"    auto sender = ex::just( std::string( \"Hello\" ) ) |                  ex::then(                     []( auto&amp;&amp; s )                     {                        for( auto&amp; c : s )                           c = std::toupper( c );                        return s;                         \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 sender&lt;std::string&gt;                     } ) |                  ex::let_value(                     []( std::string s )                     {                        return ex::just( s + \"!\" );                         \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 sender&lt;std::string&gt;                     } );     auto result = ex::sync_wait( sender );     \/\/ sync_wait \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 connect+start     if( result )    {       auto [ str ] = result.value(); \/\/ \u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0430 \u043a\u043e\u0440\u0442\u0435\u0436\u0430       std::cout &lt;&lt; \"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: \" &lt;&lt; str &lt;&lt; std::endl;    } }<\/code><\/pre>\n<p><strong>1) <\/strong><code>ex::just(\"Hello\")<\/code> \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u0433\u0440\u0430\u0444\u0443 \u0437\u0430\u0434\u0430\u0447 \u0441\u0442\u0440\u043e\u043a\u0443 <code>\"Hello\"<\/code>, \u043e\u0431\u043b\u0435\u0447\u0435\u043d\u043d\u0443\u044e \u0432 sender -&gt; (sender&lt;std::string&gt;).<\/p>\n<p><strong>2) <\/strong>\u041f\u0435\u0440\u0432\u044b\u0439<strong> <\/strong><code>then<\/code> \u0431\u0435\u0440\u0451\u0442 \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 forwarding <code>auto&amp;&amp;<\/code>, \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u0435\u0451 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <strong>\u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0443<\/strong>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u0441\u043b\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u0443 \u043d\u0430\u0441 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 <code>sender&lt;std::string&gt;<\/code>.<\/p>\n<p><strong>3) <\/strong><code>let_value<\/code>  \u0432\u0438\u0434\u0438\u0442, \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d <code>sender<\/code>, \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 sender \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0441\u0442\u0430\u043b \u0447\u0430\u0441\u0442\u044c\u044e \u043e\u0431\u0449\u0435\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0438. \u0412 \u0438\u0442\u043e\u0433\u0435 <code>sender<\/code> \u0432\u044b\u0434\u0430\u0451\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e <code>\"HELLO!\"<\/code> \u0447\u0435\u0440\u0435\u0437 <code>set_value<\/code>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u0432\u043c\u0435\u0441\u0442\u043e <code>let_value<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f <code>then<\/code>, \u0442\u043e \u043b\u044f\u043c\u0431\u0434\u0430 <code>[](std::string s){ return ex::just(s + \"!\"); }<\/code> \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u0431\u044b <code>sender&lt;std::string&gt;<\/code>, \u0438 <code>then<\/code> \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043b \u0431\u044b \u0435\u0433\u043e \u043a\u0430\u043a <strong>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong>, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0441\u0442\u0430\u043b\u043e \u0431\u044b <code>sender&lt;sender&lt;std::string&gt;&gt;<\/code>, \u0447\u0442\u043e \u043d\u0435 \u0442\u043e, \u0447\u0435\u0433\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043f\u043e\u0439\u0434\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u043f\u0443\u043b \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b\u0430\u0445, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0438 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u044b\u0439 \u043f\u043e\u0434\u0441\u0447\u0435\u0442 \u0441\u043b\u043e\u0432.<\/p>\n<pre><code class=\"cpp\">\/\/ NVIDIA-\u043f\u0443\u043b \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 #include &lt;exec\/static_thread_pool.hpp&gt;  #include &lt;fstream&gt; #include &lt;iostream&gt; #include &lt;stdexec\/execution.hpp&gt;  namespace ex = stdexec;  int main() {    \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c NVIDIA-\u043f\u0443\u043b \u0438\u0437 3 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0435\u0433\u043e scheduler:    exec::static_thread_pool pool{ 3 };    auto sched = pool.get_scheduler();     \/\/ \u041c\u0438\u043d\u0438-\u0444\u0430\u0431\u0440\u0438\u043a\u0430 sender-\u043e\u0432, \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u043b\u043e\u0432\u0430 \u0432 \u0441\u0432\u043e\u0451\u043c \u0444\u0430\u0439\u043b\u0435:    auto make_count = [ &amp;sched ]( std::string path )    {  \/\/     \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u0432 pool       return ex::schedule( sched )               \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u043f\u0443\u0442\u044c              | ex::then( [ p = std::move( path ) ] { return p; } )              | ex::then(                   []( std::string&amp;&amp; p ) -&gt; size_t                   {                      \/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0441\u043b\u043e\u0432\u0430                      std::ifstream in( p );                       if( !in ) \/\/ \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0438\u0436\u0435                         throw std::runtime_error( \"Cannot open: \" + p );                       size_t cnt = 0;                      std::string w;                      while( in &gt;&gt; w )                         ++cnt;                      std::cout &lt;&lt; \"Count in \" &lt;&lt; p &lt;&lt; \" = \" &lt;&lt; cnt &lt;&lt; std::endl;                       return cnt;                   } ) |               ex::upon_error( \/\/ \u043d\u0430\u0448 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u043e \u0432\u0441\u0435\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c                 []( std::exception_ptr ep ) -&gt; size_t                 {                   \/\/ \u0415\u0441\u043b\u0438 \u0432 \u043b\u044e\u0431\u043e\u043c \u0448\u0430\u0433\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435                    \/\/ upon_error \u0432\u0435\u0440\u043d\u0451\u0442 0, \u0438 sync_wait \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.                    try                    {                       if( ep )                          std::rethrow_exception( ep );                    }                    catch( const std::exception&amp; e )                    {                       std::cerr &lt;&lt; e.what() &lt;&lt; std::endl;                    }                    return 0;                 } );    };     \/\/ \u0421\u0442\u0440\u043e\u0438\u043c \u0442\u0440\u0438 sender-\u0430 \u2014 \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u043d\u0430 \u0444\u0430\u0439\u043b:    auto s1 = make_count( \"file1.txt\" );    auto s2 = make_count( \"file2.txt\" );    auto s3 = make_count( \"file3.txt\" );     \/\/ \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432 \u043e\u0434\u0438\u043d pipeline:    \/\/ - when_all \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0432\u0441\u0435 \u0442\u0440\u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e,    \/\/ - \u043f\u0435\u0440\u0432\u044b\u0439 then \u0443\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u0432 \u0432\u0435\u043a\u0442\u043e\u0440,    \/\/ - \u0432\u0442\u043e\u0440\u043e\u0439 then \u0441\u0443\u043c\u043c\u0438\u0440\u0443\u0435\u0442 \u0432\u0435\u043a\u0442\u043e\u0440.    auto pipeline =       ex::when_all( std::move( s1 ), std::move( s2 ), std::move( s3 ) ) |       ex::then(          []( size_t a, size_t b, size_t c ) {             return std::vector&lt; size_t &gt;{ a, b, c };          } ) |       ex::then( []( std::vector&lt; size_t &gt; v ) { return std::accumulate( v.begin(), v.end(), size_t{ 0 } ); } );     \/\/ \u0417\u0430\u043f\u0443\u0441\u043a \u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435:    auto result = ex::sync_wait( std::move( pipeline ) );     if( result )    {       auto [ total ] = result.value();       std::cout &lt;&lt; \"Total words = \" &lt;&lt; total &lt;&lt; \"\\n\";    } }<\/code><\/pre>\n<p>\u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0434\u0430\u0451\u0442 \u0447\u0438\u0441\u0442\u044b\u0439 \u0438 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c: \u043a\u0430\u0436\u0434\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u2014 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u044d\u0442\u0430\u043f \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430, \u0432\u0441\u0451 \u043b\u0435\u0433\u043a\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u0438 \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c.<\/p>\n<p>\u041d\u043e \u043d\u0430 \u044d\u0442\u043e\u043c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u043e\u043b\u044c\u0437\u0430 \u043d\u0435 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u2014 Sender\/Receiver-\u043f\u043e\u0434\u0445\u043e\u0434 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0435\u0442 \u0434\u0432\u0435\u0440\u044c \u043a \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0443 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445, \u0440\u0430\u043d\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0438\u043b\u0438 \u043d\u0435\u044f\u0432\u043d\u044b\u0445 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439.<\/p>\n<hr\/>\n<h4>\u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438\u043d\u0441\u043f\u0435\u043a\u0446\u0438\u044f: completion_signatures_of_t<\/h4>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0442\u0438\u043f\u043e\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u0438 \u0438 \u043c\u0435\u0442\u0430\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u043c \u0442\u0440\u044e\u043a\u0430\u043c (<code>value_types_of_t<\/code>, <code>completion_signatures_of_t<\/code>), \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u0439 sender \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0442\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u0432\u044b \u0433\u043e\u0442\u043e\u0432\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c. \u042d\u0442\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0430\u0435\u0442 \u0446\u0435\u043b\u044b\u0439 \u043a\u043b\u0430\u0441\u0441 \u0440\u0430\u043d\u0442\u0430\u0439\u043c-\u043e\u0448\u0438\u0431\u043e\u043a \u2014 \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d \u043c\u043e\u0436\u043d\u043e \u201c\u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c\u201d \u043a\u0430\u043a \u0442\u0438\u043f, \u0430 \u043d\u0435 \u043a\u0430\u043a \u0447\u0435\u0440\u043d\u044b\u0439 \u044f\u0449\u0438\u043a. <\/p>\n<p>\u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043f\u0440\u043e <strong>\u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0443\u044e, \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u0438\u043d\u0441\u043f\u0435\u043a\u0446\u0438\u044e<\/strong> \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0435\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0433\u043e \u0437\u0432\u0435\u043d\u0430 \u0432 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0435 \u0437\u0430\u0434\u0430\u0447.<\/p>\n<p>\u041a\u0430\u0436\u0434\u044b\u0439 sender \u0434\u0435\u043a\u043b\u0430\u0440\u0438\u0440\u0443\u0435\u0442, \u043a\u0430\u043a\u0438\u0435 \u043a\u0430\u043d\u0430\u043b\u044b \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u043e\u043d \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442.<\/p>\n<pre><code class=\"cpp\">#include &lt;stdexec\/execution.hpp&gt; #include &lt;string&gt; #include &lt;type_traits&gt;  namespace ex = stdexec;  int main() {    \/\/ \u0422\u0438\u043f \u0441\u0430\u043c\u043e\u0433\u043e sender-\u0430:    using Sender = decltype( ex::just( std::string{} ) );    \/\/ \u041e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435: \u043d\u0430\u043c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d get_scheduler, \u043d\u043e \u0434\u043b\u044f just() \u043e\u043d\u043e \u043d\u0435 \u0432\u043b\u0438\u044f\u0435\u0442 \u043d\u0430 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f    using Env = ex::env&lt; ex::get_scheduler_t &gt;;     \/\/ \u0412\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b:    using actual_sigs = ex::completion_signatures_of_t&lt; Sender, Env &gt;;    \/\/ \u0417\u0430\u0434\u0430\u0451\u043c \u0422\u041e\u041b\u042c\u041a\u041e \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0439 \u043d\u0430\u0431\u043e\u0440: just() \u0432\u044b\u0434\u0430\u0451\u0442 \u0440\u043e\u0432\u043d\u043e set_value(string)    using expected_sigs = ex::completion_signatures&lt; ex::set_value_t( std::string ) &gt;;     static_assert( std::is_same_v&lt; actual_sigs, expected_sigs &gt;,                   \"completion_signatures_of_t&lt;just(string)&gt; must be &lt;set_value(string)&gt;\" );     return 0; }<\/code><\/pre>\n<p>\u0412 \u043c\u043e\u0434\u0435\u043b\u0438 Senders\/Receivers \u0447\u0430\u0441\u0442\u044c\u044e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f <strong>environment<\/strong> \u2014 \u0441\u043e\u0432\u043e\u043a\u0443\u043f\u043d\u043e\u0441\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u043e\u0432 (scheduler, allocator, stop_token). \u041c\u044b \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435, \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0449\u0435\u0435 <strong>\u0442\u043e\u043b\u044c\u043a\u043e<\/strong> <code>get_scheduler_t<\/code>. \u0414\u043b\u044f senders, \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 scheduler, \u044d\u0442\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u0435 \u00ab\u043d\u0435\u0439\u0442\u0440\u0430\u043b\u044c\u043d\u043e\u00bb, \u043d\u043e \u0435\u0433\u043e \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u0442\u044c \u0434\u043b\u044f \u043c\u0435\u0442\u0430\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u043e\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438.<\/p>\n<p><code>completion_signatures_of_t<\/code>  &#8212; \u044d\u0442\u043e \u043c\u0435\u0442\u0430\u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u044b\u0439 CPO, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 \u0438\u0437 sender-\u0430 \u043d\u0430\u0431\u043e\u0440 \u0434\u043e\u043f\u0443\u0441\u0442\u0438\u043c\u044b\u0445 \u00ab\u043a\u0430\u043d\u0430\u043b\u043e\u0432\u00bb \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044f \u2014 \u0438\u043c\u0435\u043d\u043d\u043e <code>set_value<\/code>, <code>set_error<\/code>, <code>set_stopped<\/code> \u0432\u043c\u0435\u0441\u0442\u0435 \u0441 \u0442\u0438\u043f\u0430\u043c\u0438 \u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u041f\u043e \u0441\u0443\u0442\u0438, \u044d\u0442\u043e \u0447\u0438\u0441\u0442\u043e \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044f, \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u0430\u044f \u043d\u0430 \u044d\u0442\u0430\u043f\u0435 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438.<\/p>\n<p><code>completion_signatures<\/code> &#8212; \u044d\u0442\u043e \u0448\u0430\u0431\u043b\u043e\u043d \u0434\u043b\u044f \u044f\u0432\u043d\u043e\u0433\u043e \u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u043e\u0433\u043e \u043d\u0430\u0431\u043e\u0440\u0430 \u043a\u0430\u043d\u0430\u043b\u043e\u0432. \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u0443\u0442\u0432\u0435\u0440\u0436\u0434\u0430\u0435\u043c, \u0447\u0442\u043e <code>just(string)<\/code> \u0438\u0441\u043a\u043b\u044e\u0447\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u044b\u0434\u0430\u0451\u0442 <code>set_value(string)<\/code> \u0438 \u043d\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 <code>error<\/code> \u0438\u043b\u0438 <code>stopped<\/code>. \u041b\u044e\u0431\u043e\u0435 \u043e\u0442\u043b\u0438\u0447\u0438\u0435 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043a\u043e\u0439.<\/p>\n<p>\u0422\u0430\u043a\u043e\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u043e\u0432\u0435\u0441\u0442\u0438 \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437, <code>static_assert<\/code> \u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u044b\u0439 API \u0438 \u043f\u043e\u043a\u0440\u044b\u0442\u0438\u0435 \u0442\u0435\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u0432\u0441\u0435\u0445 \u0432\u0435\u0442\u0432\u0435\u0439 DAG:<\/p>\n<pre><code class=\"cpp\">#include &lt;exec\/static_thread_pool.hpp&gt; #include &lt;iostream&gt; #include &lt;stdexec\/execution.hpp&gt; #include &lt;type_traits&gt;  namespace ex = stdexec;  int main() {    \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c \u043f\u0443\u043b \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c scheduler    exec::static_thread_pool pool{ 2 };    auto sched = pool.get_scheduler();    using Env = ex::env&lt; ex::get_scheduler_t &gt;;     \/\/ schedule(sched) \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 sender, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438 \u0441\u0442\u0430\u0440\u0442\u0435 \u0432\u044b\u0437\u043e\u0432\u0435\u0442 set_value()    \/\/ (\u0431\u0435\u0437 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432), \u0442\u043e \u0435\u0441\u0442\u044c \u0435\u0433\u043e \u00abvalue\u00bb-\u043a\u0430\u043d\u0430\u043b \u0438\u043c\u0435\u0435\u0442 \u0442\u0438\u043f void.    auto stage1 = ex::schedule( sched )       \/\/ then \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 void() \u0438 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0435\u0433\u043e \u0432 std::vector&lt;int&gt;       | ex::then(            []() {               return std::vector&lt; int &gt;{ 1, 2, 3, 4, 5 };            } );     \/\/ \u041a\u0430\u043a\u0438\u0435 \u043a\u0430\u043d\u0430\u043b\u044b completion \u0437\u0434\u0435\u0441\u044c?    \/\/  - set_error(exception_ptr) \u2014 \u0435\u0441\u043b\u0438 \u043f\u0440\u0438 scheduling \u0438\u043b\u0438 \u0432 \u043b\u044f\u043c\u0431\u0434\u0435 \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u043b\u043e\u0441\u044c    \/\/  - set_stopped()           \u2014 \u0435\u0441\u043b\u0438 \u043e\u0442\u043c\u0435\u043d\u0438\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u0434\u043e \u0438\u043b\u0438 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f    \/\/  - set_value(vector&lt;int&gt;)  \u2014 \u0443\u0441\u043f\u0435\u0448\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441 \u043d\u0430\u0448\u0438\u043c \u0432\u0435\u043a\u0442\u043e\u0440\u043e\u043c     using stage1_sigs = ex::completion_signatures_of_t&lt; decltype( stage1 ), Env &gt;;    using expected_stage1 = ex::completion_signatures&lt;                ex::set_error_t( std::exception_ptr ), ex::set_stopped_t(),               ex::set_value_t( std::vector&lt; int &gt; ) &gt;;       static_assert( std::is_same_v&lt; stage1_sigs, expected_stage1 &gt;,                   \"Stage1: unexpected signatures\" );    \/\/ \u0417\u0434\u0435\u0441\u044c \u0432\u0441\u0451 \u043e\u043a: void\u2192vector&lt;int&gt; \u043f\u043e\u0441\u043b\u0435 then, \u043f\u043b\u044e\u0441 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u044b\u0435 error\/stopped.     \/\/ === Pipeline: then(vector\u2192int) + upon_error \u2192 int ===    auto pipeline = stage1    \/\/ then \u2500 \u0431\u0435\u0440\u0451\u0442 \u043d\u0430 \u0432\u0445\u043e\u0434 vector&lt;int&gt; \u0438\u0437 stage1    \/\/ \u0438 \"\u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442\" \u043a\u0430\u043d\u0430\u043b set_value(vector&lt;int&gt;) \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 \u043a\u0430\u043d\u0430\u043b set_value(int).    | ex::then( []( const std::vector&lt; int &gt;&amp; v ) { return std::accumulate( v.begin(), v.end(), 0 ); } )    \/\/   ex::upon_error \u2500 \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043b\u044e\u0431\u043e\u0439 exception_ptr \u0438\u0437 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0445 senders    | ex::upon_error([]( std::exception_ptr ep )                     {                        try                        {                           if( ep )                              std::rethrow_exception( ep );                        }                        catch( const std::exception&amp; e )                        {                           std::cerr &lt;&lt; \"[Error] \" &lt;&lt; e.what() &lt;&lt; \"\\n\";                        }                        return -1;                     } );     \/\/ \u0418\u043d\u0441\u043f\u0435\u043a\u0446\u0438\u044f completion_sigs \u0434\u043b\u044f pipeline:    \/\/ 1) set_error(exception_ptr)  \u2014 \u043b\u044e\u0431\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0430 \u043b\u044e\u0431\u043e\u043c \u044d\u0442\u0430\u043f\u0435    \/\/ 2) set_stopped() \u2014 \u043a\u043e\u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043e\u0442\u043c\u0435\u043d\u0430 (schedule + then \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u044e\u0442 stopped)    \/\/ 3) set_value(int) \u2014 \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439 value'\u043a\u0430\u043d\u0430\u043b \u043f\u043e\u0441\u043b\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e then\/upon_error    using pipeline_sigs = ex::completion_signatures_of_t&lt; decltype( pipeline ), Env &gt;;        using expected_pipeline =       ex::completion_signatures&lt; ex::set_error_t( std::exception_ptr ),        ex::set_stopped_t(), ex::set_value_t( int ) &gt;;       static_assert( std::is_same_v&lt; pipeline_sigs, expected_pipeline &gt;,                   \"Pipeline: unexpected signatures\" );    \/\/ \u0417\u0434\u0435\u0441\u044c \u043d\u0435\u0442 set_value(vector&lt;int&gt;) \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e then     auto result = ex::sync_wait( std::move( pipeline ) );    if( result )    {       auto [ r ] = result.value();       std::cout &lt;&lt; \"Result = \" &lt;&lt; r &lt;&lt; \"\\n\"; \/\/ \u0412\u044b\u0432\u043e\u0434: Result = 15    } }<\/code><\/pre>\n<p>\u0414\u0430\u043d\u043d\u044b\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0444\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0447\u0435\u0440\u0435\u0437 \u0431\u0435\u0437 \u0437\u0430\u043f\u0443\u0441\u043a\u0430, \u0432 \u0447\u0438\u0441\u0442\u043e \u0442\u0438\u043f\u043e\u0432\u043e\u043c \u0432\u0438\u0434\u0435 \u0438 \u0432\u044b\u044f\u0432\u043b\u044f\u0442\u044c \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0435 \u043e\u0448\u0438\u0431\u043a\u0438 \u0438 \u043d\u0435\u0441\u043e\u0433\u043b\u0430\u0441\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u0438 \u0432 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0430\u0445, \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u043f\u0440\u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0434\u0430\u043d\u043d\u044b\u0445 \u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439. \u041c\u043e\u0436\u0435\u0442, \u043d\u0435\u043c\u043d\u043e\u0433\u043e, \u043d\u043e \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0443\u0434\u043e\u0431\u043d\u0435\u0435.<\/p>\n<hr\/>\n<h4>\u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 tag_invoke<\/h4>\n<p>\u0412 <code>&lt;execution&gt;<\/code> \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u00abcore operation\u00bb (<code>schedule<\/code>, <code>connect<\/code>, <code>start<\/code> \u0438 \u0442.\u0434.) \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 customization-point object (CPO), \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0447\u0435\u0440\u0435\u0437 \u0432\u044b\u0437\u043e\u0432 <code>tag_invoke<\/code>.<\/p>\n<p>\u041f\u0440\u0438 \u0432\u044b\u0437\u043e\u0432\u0435<\/p>\n<pre><code class=\"cpp\">ex::schedule(some_scheduler);<\/code><\/pre>\n<p>\u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0438\u0449\u0435\u0442 \u0441\u0432\u043e\u0431\u043e\u0434\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e<\/p>\n<pre><code class=\"cpp\">tag_invoke(ex::schedule_t, \/* \u0432\u0430\u0448 \u0442\u0438\u043f scheduler *\/ )<\/code><\/pre>\n<p>\u0438 \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u043d\u0430\u0439\u0434\u0435\u043d\u0430 \u2014 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u0435\u0451.<\/p>\n<p>\u041c\u044b \u043e\u0431\u043e\u0440\u0430\u0447\u0438\u0432\u0430\u0435\u043c <code>schedule<\/code> \u0434\u043b\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e <code>profiling_scheduler<\/code>, \u0447\u0442\u043e\u0431\u044b \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u043c\u0435\u0440\u044f\u0442\u044c \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c:<\/p>\n<pre><code class=\"cpp\">\/\/ Profiling-scheduler: \u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c scheduler-\u043e\u043c  struct profiling_scheduler  {    exec::static_thread_pool::scheduler base;  };<\/code><\/pre>\n<p>\u041d\u0438\u0436\u0435 \u043f\u043e \u043a\u043e\u0434\u0443 \u043c\u044b \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u043c \u0441\u0432\u043e\u0439 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0439 tag_invoke:<\/p>\n<pre><code class=\"cpp\">\/\/ \u041f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 schedule(ps) \u0447\u0435\u0440\u0435\u0437 tag_invoke inline auto tag_invoke( ex::schedule_t, profiling_scheduler ps ) {    \/\/ \u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 sender&lt;void&gt; \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0432 \u043f\u0443\u043b    auto s = ex::schedule( ps.base );    \/\/ \u0412\u0435\u0448\u0430\u0435\u043c then-\u043b\u044f\u043c\u0431\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043c\u0435\u0440\u0438\u0442\u044c    return s | ex::then(                  [ start = std::chrono::steady_clock::now() ]()                  {                     auto dur = std::chrono::steady_clock::now() - start;                     std::cout &lt;&lt; \"[Profiling] schedule\u2192execution: \"                                &lt;&lt; dur.count() &lt;&lt; std::endl;                  } ); }<\/code><\/pre>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 <strong>\u043a\u0430\u0436\u0434\u044b\u0439<\/strong> <code>schedule(ps)<\/code> \u0432\u044b\u0432\u043e\u0434\u0438\u0442 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0443 \u043f\u0435\u0440\u0435\u0432\u043e\u0434a \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u043f\u0443\u043b \u0431\u0435\u0437 \u043f\u0440\u0430\u0432\u043a\u0438 \u0431\u0438\u0437\u043d\u0435\u0441-\u043b\u043e\u0433\u0438\u043a\u0438, \u0438\u043d\u0430\u0447\u0435 \u0433\u043e\u0432\u043e\u0440\u044f,<strong> <\/strong>\u0437\u0430\u043c\u0435\u0440\u044f\u0435\u0442 \u0432\u0440\u0435\u043c\u044f \u043e\u0442 \u0432\u044b\u0437\u043e\u0432\u0430 <code>schedule(...)<\/code> \u0434\u043e \u0440\u0435\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043d\u0430\u0447\u0430\u043b\u0430 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0437\u0430\u0434\u0430\u0447\u0438 \u0432 \u043f\u0443\u043b\u0435. <\/p>\n<p>\u0421\u043f\u043e\u0441\u043e\u0431\u043e\u0432 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0430, \u0430 \u0432\u043e\u0442 \u043a\u0430\u043a \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0434\u043e\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440:<\/p>\n<pre><code class=\"cpp\">#include &lt;exec\/static_thread_pool.hpp&gt; #include &lt;fstream&gt; #include &lt;iostream&gt; #include &lt;stdexec\/execution.hpp&gt;  namespace ex = stdexec;  \/\/ Profiling-scheduler: \u043e\u0431\u0451\u0440\u0442\u043a\u0430 \u043d\u0430\u0434 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u043c scheduler-\u043e\u043c struct profiling_scheduler {    exec::static_thread_pool::scheduler base; };  \/\/ \u041f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 schedule(ps) \u0447\u0435\u0440\u0435\u0437 tag_invoke inline auto tag_invoke( ex::schedule_t, profiling_scheduler ps ) {    \/\/ \u041e\u0440\u0438\u0433\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0439 sender&lt;void&gt; \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0432 \u043f\u0443\u043b    auto s = ex::schedule( ps.base );    \/\/ \u0412\u0435\u0448\u0430\u0435\u043c then-\u043b\u044f\u043c\u0431\u0434\u0443, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043c\u0435\u0440\u0438\u0442\u044c    return s | ex::then(                  [ start = std::chrono::steady_clock::now() ]()                  {                     auto dur = std::chrono::steady_clock::now() - start;                     std::cout &lt;&lt; \"[Profiling] schedule\u2192execution: \"                                &lt;&lt; dur.count() &lt;&lt; std::endl;                  } ); }  int main() {    \/\/ \u0413\u043e\u0442\u043e\u0432\u0438\u043c \u043f\u0443\u043b \u0438 profiling_scheduler    exec::static_thread_pool pool{ 3 };    profiling_scheduler ps{ pool.get_scheduler() };    auto sched = ps;     std::vector&lt; std::string &gt; files = { \"file1.txt\", \"file2.txt\", \"file3.txt\" };     \/\/ 6. \u0424\u0430\u0431\u0440\u0438\u043a\u0430 senders \u0434\u043b\u044f \u043f\u043e\u0434\u0441\u0447\u0451\u0442\u0430 \u0441\u043b\u043e\u0432    auto make_count = [ &amp; ]( std::string path )    {       return ex::schedule( sched ) | ex::then( [ p = std::move( path ) ]                                                 { return p; } ) |              ex::then(                 [ &amp; ]( std::string p ) -&gt; size_t                 {                    std::ifstream in( p );                    if( !in )                       throw std::runtime_error( \"Cannot open \" + p );                     size_t cnt = 0;                    std::string w;                    while( in &gt;&gt; w )                    {                        ++cnt;                    }                    std::cout &lt;&lt; \"Count in \" &lt;&lt; p &lt;&lt; \" = \" &lt;&lt; cnt &lt;&lt; std::endl;                     return cnt;                 } ) |              ex::upon_error(                 []( std::exception_ptr ep ) -&gt; size_t                 {                    try                    {                       if( ep )                          std::rethrow_exception( ep );                    }                    catch( const std::exception&amp; e )                    {                       std::cerr &lt;&lt; e.what() &lt;&lt; \"\\n\";                    }                    return 0;                 } );    };     auto s1 = make_count( files[ 0 ] );    auto s2 = make_count( files[ 1 ] );    auto s3 = make_count( files[ 2 ] );     \/\/ \u041a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f: parallel \u2192 vector \u2192 sum    auto pipeline =       ex::when_all( std::move( s1 ), std::move( s2 ), std::move( s3 ) ) |       ex::then(          []( size_t a, size_t b, size_t c ) {             return std::vector&lt; size_t &gt;{ a, b, c };          } ) |       ex::then( []( std::vector&lt; size_t &gt; v )                 { return std::accumulate( v.begin(), v.end(), size_t{ 0 } ); } );     auto result = ex::sync_wait( std::move( pipeline ) );    if( result )    {       auto [ r ] = result.value();       std::cout &lt;&lt; \"[Main] Total words = \" &lt;&lt; r &lt;&lt; \"\\n\";    } }<\/code><\/pre>\n<hr\/>\n<h4>\u0412 \u0442\u0440\u0435\u0442\u044c\u0438\u0445, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0443\u0434\u043e\u0431\u043d\u0430\u044f \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043a\u043e\u043e\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u0430\u044f \u043e\u0442\u043c\u0435\u043d\u0430<\/h4>\n<p>\u0410\u0434\u0430\u043f\u0442\u043e\u0440 <code>upon_error<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0443\u043d\u0435\u0441\u0442\u0438 <code>try\/catch<\/code> \u0438\u0437 <code>main<\/code>, \u0441\u0434\u0435\u043b\u0430\u0432 \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0448\u0438\u0431\u043e\u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u044c\u044e \u043a\u043e\u0434\u0430.  \u042d\u0442\u043e \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442 \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u0431\u0435\u0437 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430. \u041e\u043d \u043d\u0435 \u0437\u0430\u043c\u0435\u043d\u044f\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0443, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 &#171;\u043f\u043e\u0431\u043e\u0447\u043d\u044b\u0439 \u044d\u0444\u0444\u0435\u043a\u0442&#187;. \u042d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0443\u0434\u043e\u0431\u043d\u043e,  \u043a\u043e\u0433\u0434\u0430 \u0445\u043e\u0447\u0435\u0448\u044c \u0437\u0430\u043b\u043e\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0438\u043b\u0438  \u043d\u0430\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u0441\u043e\u043e\u0431\u0449\u0435\u043d\u0438\u0435 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c \u0438\u043b\u0438 \u043c\u0435\u0442\u0440\u0438\u043a\u0443 \u0432 \u043c\u043e\u043d\u0438\u0442\u043e\u0440\u0438\u043d\u0433.<\/p>\n<pre><code class=\"cpp\">| ex::upon_error([]( std::exception_ptr ep )                     {                        try                        {                           if( ep )                              std::rethrow_exception( ep );                        }                        catch( const std::exception&amp; e )                        {                           std::cerr &lt;&lt; \"[Error] \" &lt;&lt; e.what() &lt;&lt; \"\\n\";                        }                        return -1;                     } );<\/code><\/pre>\n<p>\u0410\u0434\u0430\u043f\u0442\u043e\u0440 <code>let_error<\/code> &#8212; \u044d\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0438 \u043d\u0430 \u043d\u043e\u0432\u044b\u0439 sender, \u043a\u043e\u0433\u0434\u0430 <strong>\u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f <\/strong>\u0432\u044b\u0431\u0440\u043e\u0448\u0435\u043d\u043d\u044b\u0439 <code>set_error<\/code>, \u0438 \u043f\u043e\u0434\u043c\u0435\u043d\u044f\u0435\u0442 \u043d\u0430 <strong>\u043d\u043e\u0432\u044b\u0439 sender<\/strong>. \u041f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 <code>set_value<\/code><strong>, <\/strong><code>set_stopped<\/code> \u0438\u043b\u0438 \u0434\u0430\u0436\u0435 \u0434\u0440\u0443\u0433\u0443\u044e \u043e\u0448\u0438\u0431\u043a\u0443. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043f\u0435\u0440\u0435\u0432\u0435\u0441\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0443 \u0432 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0443 &#8212; <code>just_stopped()<\/code> \u0438\u043b\u0438 \u043f\u0435\u0440\u0435\u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043b\u043e\u0433\u0438\u043a\u0443 \u0441 \u0434\u0440\u0443\u0433\u0438\u043c \u043f\u0443\u0442\u0451\u043c.<\/p>\n<pre><code class=\"cpp\">#include &lt;fstream&gt; #include &lt;iostream&gt; #include &lt;stdexec\/execution.hpp&gt;  namespace ex = stdexec;  int main() {    \/\/ \u041f\u043e\u0441\u0442\u0440\u043e\u0438\u043c \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 sender, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \"\u0447\u0438\u0442\u0430\u0435\u0442\" \u0444\u0430\u0439\u043b    auto sender = ex::just( std::string{ \"missing.txt\" } )                  \/\/ \u041f\u044b\u0442\u0430\u0435\u043c\u0441\u044f \u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0444\u0430\u0439\u043b \u0438, \u0435\u0441\u043b\u0438 \u043d\u0435 \u043c\u043e\u0436\u0435\u043c \u2014 \u0431\u0440\u043e\u0441\u0430\u0435\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435                  | ex::then(                       []( std::string path ) -&gt; size_t                       {                          std::ifstream in( path );                          if( !in )                             throw std::runtime_error( \"File not found: \" + path );                          \/\/ \u0422\u0443\u0442 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0432\u0430\u0448\u0430 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0447\u0442\u0435\u043d\u0438\u044f\/\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438...                          return 0;                       } )                  \/\/ 4) let_error \u043f\u0435\u0440\u0435\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u0435\u0442 \u043b\u044e\u0431\u043e\u0435 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u0432\u043c\u0435\u0441\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0438                  \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 sender, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u0438\u0442 set_stopped()                  | ex::let_error(                       []( std::exception_ptr )                       {                          \/\/ just_stopped() \u2014 sender, \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0449\u0438\u0439 set_stopped()                          return ex::just_stopped();                       } );     auto result = ex::sync_wait( std::move( sender ) );     if( result )    {       \/\/ \u0415\u0441\u043b\u0438 value \u043f\u0440\u0438\u0448\u043b\u043e, \u0437\u043d\u0430\u0447\u0438\u0442 \u0444\u0430\u0439\u043b \u043d\u0430\u0448\u0451\u043b\u0441\u044f       auto [ r ] = result.value();       std::cout &lt;&lt; \"File opened successfully, result = \" &lt;&lt; r &lt;&lt; \"\\n\";    }    else    {       \/\/ \u041f\u0443\u0441\u0442\u043e\u0439 optional \u2014 \u043b\u0438\u0431\u043e \u043e\u0448\u0438\u0431\u043a\u0430, \u043b\u0438\u0431\u043e \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430 \u0447\u0435\u0440\u0435\u0437 set_stopped       std::cout &lt;&lt; \"Operation was cancelled or file not found\\n\";    } }<\/code><\/pre>\n<hr\/>\n<h4>\u0418\u0437 \u043e\u0441\u0442\u0430\u0432\u0448\u0435\u0433\u043e\u0441\u044f, \u043d\u043e \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u043f\u0440\u0438\u044f\u0442\u043d\u043e\u0433\u043e:<\/h4>\n<h3>\u041a\u043e\u0440\u0443\u0442\u0438\u043d\u043d\u0430\u044f \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044f (&#171;P3109R0&#187;). C++26 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e co_await \u043b\u044e\u0431\u043e\u0439 single-value sender: co_await pipeline.<\/h3>\n<p>\u041f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043c\u043e\u0436\u043d\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c <code>task&lt;T&gt;<\/code> \u043a\u0430\u043a \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0443-sender, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u043f\u043e\u043b\u043d\u044b\u0439 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u0436\u0438\u0437\u043d\u0435\u043d\u043d\u044b\u043c \u0446\u0438\u043a\u043b\u043e\u043c.<\/p>\n<h3>Parallel Algorithms \u0438 policy_aware_scheduler (P2079R5)<\/h3>\n<p>\u041f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u0432 C++26 \u043f\u0440\u0438\u043c\u0443\u0442 <code>scheduler<\/code> \u0432\u043c\u0435\u0441\u0442\u043e <code>execution_policy<\/code>:<\/p>\n<pre><code class=\"cpp\">std::for_each( sched, v.begin(), v.end(), []( auto&amp; x ) { x *= 2; } );<\/code><\/pre>\n<hr\/>\n<p><strong>\u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0442\u0435\u043a\u0443\u0449\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u0438 \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u0421++, \u043a\u0430\u043a \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u0435 \u0438\u0434\u0435\u0438:<\/strong><\/p>\n<h4>Backpressure &#8212; \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c set_stopped \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0431\u0443\u0444\u0435\u0440\u0430, downstream \u0432\u043e\u0437\u043e\u0431\u043d\u043e\u0432\u043b\u044f\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443 \u0447\u0435\u0440\u0435\u0437 set_value \u043f\u043e \u0441\u043e\u0431\u044b\u0442\u0438\u044e \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f.<\/h4>\n<h4>Fan-out \/ Fan-in &#8212; \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u043e\u0440\u043e\u0436\u0434\u0435\u043d\u0438\u0435 senders \u0438 \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 when_all_range \u0434\u043b\u044f \u0430\u0434\u0430\u043f\u0442\u0438\u0432\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447.<\/h4>\n<h4>Split \/ Multicast &#8212; \u043e\u0434\u0438\u043d \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0434\u0430\u043d\u043d\u044b\u0445 \u2014 \u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0442\u0440\u0435\u0431\u0438\u0442\u0435\u043b\u0435\u0439 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0431\u0435\u0437 \u043f\u043e\u0432\u0442\u043e\u0440\u043d\u043e\u0433\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f.<\/h4>\n<p>Retry \u0441 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u043c backoff &#8212; \u0435\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0443 \u0431\u0440\u043e\u0441\u0438\u043b\u0430 \u043e\u0448\u0438\u0431\u043a\u0430 (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441\u0435\u0442\u044c \u0443\u043f\u0430\u043b\u0430), \u0445\u043e\u0442\u0438\u043c \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c \u0435\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0441 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u044e\u0449\u0435\u0439\u0441\u044f \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u043e\u0439 <\/p>\n<p>Batching, Circuit-breaker, throttling, debounce \u0438 \u0442.\u0434.  \u0438 \u0442.\u0434.  \u0438 \u0442.\u0434.  <\/p>\n<hr\/>\n<h4>\u041d\u0435 \u0431\u0435\u0437 \u043b\u043e\u0436\u043a\u0438 \u0434\u0451\u0433\u0442\u044f, \u0430 \u0438\u043c\u0435\u043d\u043d\u043e, \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0438 \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f (2025)<\/h4>\n<ul>\n<li>\n<p>\u0421\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c API \u0438 \u043a\u0440\u0443\u0442\u0430\u044f \u043a\u0440\u0438\u0432\u0430\u044f \u0432\u0445\u043e\u0436\u0434\u0435\u043d\u0438\u044f. \u041f\u0440\u0438\u043d\u0446\u0438\u043f\u0438\u0430\u043b\u044c\u043d\u0430\u044f \u0441\u0438\u043b\u0430 \u043c\u043e\u0434\u0435\u043b\u0438 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u043d\u0430 \u0448\u0430\u0431\u043b\u043e\u043d\u0430\u0445, \u043a\u043e\u043d\u0446\u0435\u043f\u0442\u0430\u0445 \u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u0430\u0445 CPO (<code>then<\/code>, <code>let_value<\/code>, <code>upon_error<\/code>, <code>when_all<\/code> \u0438 \u0442. \u0434.). \u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442, \u043a\u0430\u043a \u00ab\u043b\u0435\u0441 \u0438\u0437 \u043c\u0435\u0442\u0430\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f\u00bb.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0433\u043e <code>thread_pool<\/code> \u0432 <code>&lt;execution&gt;<\/code> \u2014 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0432\u044b\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u0442\u043e\u0440\u043e\u043d\u043d\u0438\u0439: NVIDIA stdexec, Boost, TBB, Folly, libunifex \u0438\u043b\u0438 \u0432\u0430\u0448\u0430 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u044d\u0442\u043e \u0440\u0443\u0447\u043d\u0430\u044f \u043e\u0442\u043c\u0435\u043d\u0430, \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 <code>stop_requested()<\/code> \u0432\u043d\u0443\u0442\u0440\u0438 <code>then<\/code>. \u041d\u0430 2025 \u0433\u043e\u0434 \u0432 \u043c\u043e\u0434\u0435\u043b\u0438 P2300 \u043e\u0442\u043c\u0435\u043d\u0430 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <code>stop_token<\/code> \u0432 <code>env<\/code>, \u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0443\u0434\u043e\u0431\u043d\u043e\u0435 \u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e \u2014 \u0430\u0434\u0430\u043f\u0442\u0435\u0440 <code>let_stopped<\/code> \u2014 \u0435\u0449\u0451 \u043d\u0435 \u0441\u0442\u0430\u043b\u043e \u043e\u0431\u0449\u0435\u043f\u0440\u0438\u043d\u044f\u0442\u044b\u043c. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0447\u0442\u043e\u0431\u044b \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0435\u0440\u044b\u0432\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0446\u0438\u043a\u043b\u044b \u0432\u043d\u0443\u0442\u0440\u0438 <code>then<\/code>, \u043d\u0443\u0436\u043d\u043e \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u0444\u043b\u0430\u0433 \u043e\u0442\u043c\u0435\u043d\u044b \u0438\u043b\u0438 \u0431\u0440\u043e\u0441\u0430\u0442\u044c \u0441\u0432\u043e\u0451 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/p>\n<\/li>\n<li>\n<p>IDE \u043f\u043e\u043a\u0430 \u043d\u0435 \u0443\u043c\u0435\u044e\u0442 \u0432\u0438\u0437\u0443\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c DAG senders, \u043d\u043e \u044d\u0442\u043e \u043f\u043e\u043a\u0430&#8230; <\/p>\n<\/li>\n<\/ul>\n<hr\/>\n<h4>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435 \u0438 \u0440\u0435\u0441\u0443\u0440\u0441\u044b<\/h4>\n<p>Senders\/Receivers \u0432 C++26 \u043c\u0435\u043d\u044f\u044e\u0442 \u043f\u0430\u0440\u0430\u0434\u0438\u0433\u043c\u0443 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438 \u0441 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043d\u0430 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0433\u0440\u0430\u0444\u0430 \u0437\u0430\u0434\u0430\u0447:<\/p>\n<ul>\n<li>\n<p>\u0412\u044b \u0431\u043e\u043b\u044c\u0448\u0435 \u043d\u0435 \u0441\u043c\u0435\u0448\u0438\u0432\u0430\u0435\u0442\u0435 \u043b\u043e\u0433\u0438\u043a\u0443 \u0440\u0430\u0431\u043e\u0442\u044b \u0441 \u043f\u043e\u0442\u043e\u043a\u0430\u043c\u0438, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043e\u0448\u0438\u0431\u043e\u043a \u0438 \u043e\u0442\u043c\u0435\u043d\u0443 \u0432 \u0441\u0432\u043e\u0438\u0445 \u0431\u0438\u0437\u043d\u0435\u0441-\u0444\u0443\u043d\u043a\u0446\u0438\u044f\u0445. \u041a\u0430\u0436\u0434\u044b\u0439 \u044d\u0442\u0430\u043f \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430\/\u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430 \u2014 \u0441\u0432\u043e\u0439 sender, \u0441\u0432\u043e\u0439 \u0430\u0434\u0430\u043f\u0442\u0435\u0440 (<code>then<\/code>, <code>upon_error<\/code>, <code>let_error<\/code> \u0438 \u0442. \u0434.) \u0438 \u0441\u0432\u043e\u0439 receiver.<\/p>\n<\/li>\n<li>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f static-inspection (<code>completion_signatures_of_t<\/code>) \u0438 \u0441\u0442\u0440\u043e\u0433\u0438\u043c \u043a\u043e\u043d\u0446\u0435\u043f\u0442\u0430\u043c \u0432\u044b \u0441\u0440\u0430\u0437\u0443 \u0432\u0438\u0434\u0438\u0442\u0435, \u043a\u0430\u043a\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u043e\u0448\u0438\u0431\u043a\u0438 \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0438 \u043c\u043e\u0433\u0443\u0442 \u043f\u0440\u043e\u0439\u0442\u0438 \u043f\u043e \u0432\u0430\u0448\u0435\u043c\u0443 DAG-\u0443. \u041f\u043e\u043c\u0435\u043d\u044f\u043b\u0438\u0441\u044c \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u2014 \u043f\u043e\u043c\u0435\u043d\u044f\u043b\u0441\u044f \u0438 \u043f\u043e\u0434\u0445\u043e\u0434 \u043a \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e.<\/p>\n<\/li>\n<li>\n<p>\u0410\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f scheduler \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u0442 \u0432\u0430\u0441 \u043e\u0442 \u043d\u0430\u0432\u044f\u0437\u0447\u0438\u0432\u044b\u0445 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0439 thread-pool \u0438\u043b\u0438 event-loop. \u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u044e\u0442 scheduler \u043f\u0440\u044f\u043c\u043e \u0432 <code>&lt;algorithm&gt;<\/code>\/<code>&lt;ranges&gt;<\/code>, \u0430 \u043a\u0430\u0441\u0442\u043e\u043c\u043d\u044b\u0435 schedulers (GPU, GUI, \u0440\u0435\u0430\u043a\u0442\u043e\u0440) \u043b\u0435\u0433\u043a\u043e \u0432\u0441\u0442\u0440\u0430\u0438\u0432\u0430\u044e\u0442\u0441\u044f.<\/p>\n<\/li>\n<li>\n<p><code>tag_invoke<\/code> \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u00ab\u043f\u0440\u0438\u0432\u0430\u0440\u0438\u0442\u044c\u00bb \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435, \u0442\u0440\u0430\u0441\u0441\u0438\u0440\u043e\u0432\u043a\u0443, backpressure-\u043c\u0435\u0445\u0430\u043d\u0438\u043a\u0443, retry-\u043f\u043e\u043b\u0438\u0442\u0438\u043a\u0443 \u0438 \u043b\u044e\u0431\u0443\u044e \u0434\u0440\u0443\u0433\u0443\u044e \u043b\u043e\u0433\u0438\u043a\u0443 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 CPO, \u043d\u0435 \u043f\u043e\u0440\u0442\u0438\u0448\u044c \u0447\u0438\u0441\u0442\u043e\u0442\u0443 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0430.<\/p>\n<\/li>\n<li>\n<p> <code>co_await sender<\/code> \u0438 <code>task&lt;T&gt;<\/code> \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u044e\u0442 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b \u0432 \u043f\u043e\u043b\u043d\u043e\u043f\u0440\u0430\u0432\u043d\u044b\u0445 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432 DAG-\u0430, \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u044f \u0440\u0430\u0437\u0440\u043e\u0437\u043d\u0435\u043d\u043d\u043e\u0441\u0442\u044c <code>std::future<\/code>, Asio \u0438 <code>co_await<\/code>. \u0412\u0441\u0451 \u0435\u0434\u0438\u043d\u043e \u0438 \u0432\u0437\u0430\u0438\u043c\u043e\u0441\u0432\u044f\u0437\u0430\u043d\u043e.<\/p>\n<\/li>\n<\/ul>\n<blockquote>\n<p>\u041e\u0441\u0442\u0430\u0451\u0442\u0441\u044f \u043d\u0430\u0434\u0435\u044f\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u0434\u043d\u0430\u0436\u0434\u044b C++ \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442 \u0431\u044b\u0442\u044c \u00ab\u044d\u043f\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0438\u0441\u043f\u044b\u0442\u0430\u043d\u0438\u0435\u043c\u00bb, \u0438 \u0441\u0442\u0430\u043d\u0435\u0442 \u044f\u0437\u044b\u043a\u043e\u043c, \u043d\u0430 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043f\u0440\u043e\u0441\u0442\u043e \u0445\u043e\u0447\u0435\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c<strong>.<\/strong><\/p>\n<\/blockquote>\n<p><strong>\u041f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a\u0438:<\/strong><\/p>\n<ul>\n<li>\n<p>P2300R10 (std::execution) <a href=\"https:\/\/wg21.link\/P2300\" rel=\"noopener noreferrer nofollow\">wg21.link<\/a><\/p>\n<\/li>\n<li>\n<p>P2079R5 (policy_aware_scheduler) <a href=\"https:\/\/wg21.link\/P2079R5\" rel=\"noopener noreferrer nofollow\">wg21.link<\/a><\/p>\n<\/li>\n<li>\n<p>P3109R0 (co_await sender ) <a href=\"https:\/\/isocpp.org\/blog\/2025\/01\/senders-receivers-an-introduction-lucian-radu-teodorescu\" rel=\"noopener noreferrer nofollow\">isocpp<\/a><\/p>\n<\/li>\n<li>\n<p>NVIDIA \u044d\u0442\u0430\u043b\u043e\u043d\u043d\u0430\u044f \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f P2300 <a href=\"https:\/\/github.com\/NVIDIA\/stdexec\" rel=\"noopener noreferrer nofollow\">GitHub<\/a><\/p>\n<\/li>\n<li>\n<p>stdexec Dev Documentation \u2014  \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f \u043f\u043e <a href=\"https:\/\/nvidia.github.io\/stdexec\/\" rel=\"noopener noreferrer nofollow\"><code>stdexec<\/code><\/a> (<a href=\"https:\/\/nvidia.github.io\/stdexec\/reference\/index.html\" rel=\"noopener noreferrer nofollow\">User\u2019s Guide \u0438 Reference<\/a>)<\/p>\n<\/li>\n<li>\n<p>Zenn.dev: WG21\/P2300 <a href=\"https:\/\/zenn.dev\/yohhoy\/scraps\/5c500ed9096792\" rel=\"noopener noreferrer nofollow\">std::execution <\/a><\/p>\n<\/li>\n<li>\n<p><a href=\"https:\/\/en.cppreference.com\/w\/cpp\/execution\" rel=\"noopener noreferrer nofollow\">cppreference<\/a>  <\/p>\n<\/li>\n<\/ul>\n<div class=\"persona\"><img class=\"image persona__image\"\/><\/p>\n<h5 class=\"persona__heading\">\u041a\u043e\u0441\u0438\u043d\u0446\u0435\u0432 \u0410\u0440\u0442\u0451\u043c<\/h5>\n<p class=\"persona__text\">\u0418\u043d\u0436\u0435\u043d\u0435\u0440-\u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442<\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/904134\/\"> https:\/\/habr.com\/ru\/articles\/904134\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043a\u0430\u0436\u0434\u044b\u0439 \u0434\u0435\u043d\u044c \u043c\u044b \u0441\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u0435\u043c\u0441\u044f \u0441 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u043f\u0438\u0441\u0430\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0439 \u0438 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434: \u0437\u0430\u0433\u0440\u0443\u0437\u043a\u0430 \u0441\u0435\u0442\u0435\u0432\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445, \u0432\u0437\u0430\u0438\u043c\u043e\u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0441 \u0411\u0414, UI-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430, \u0444\u043e\u043d\u043e\u0432\u044b\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f. \u0422\u0440\u0430\u0434\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u2014 std::thread, std::async, std::future \u2014 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u044e\u0442 boilerplate, \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u043d\u043d\u044b\u0435 try\/catch, \u0441\u043b\u043e\u0436\u043d\u0443\u044e \u043e\u0442\u043c\u0435\u043d\u0443 \u0438 \u00abcallback hell\u00bb.<\/p>\n<p>\u0412\u0437\u0430\u043c\u0435\u043d \u044d\u0442\u043e\u0433\u043e C++26 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0438\u0437\u0438\u0440\u0443\u0435\u0442 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u0443\u044e \u043c\u043e\u0434\u0435\u043b\u044c <strong>Senders\/Receivers<\/strong> \u0432 \u0437\u0430\u0433\u043e\u043b\u043e\u0432\u043a\u0435 <code>&lt;execution&gt;<\/code>, \u0434\u043e\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u0443\u044e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u043c\u043e\u0441\u0442\u044c\u044e \u0441 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u0430\u043c \u0438 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432 \u0447\u0435\u0440\u0435\u0437 <code>policy_aware_scheduler<\/code>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c:<\/p>\n<ul>\n<li>\n<p>\u0415\u0434\u0438\u043d\u044b\u0439 API \u0434\u043b\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438 \u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u043c\u0430, \u0443\u0441\u0442\u0440\u0430\u043d\u044f\u044e\u0449\u0438\u0439 \u00abcallback-hell\u00bb \u0438 \u0433\u0440\u043e\u043c\u043e\u0437\u0434\u043a\u043e\u0441\u0442\u044c <code>std::future\/std::async<\/code> <\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u043e\u043d\u043d\u044b\u0435 \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u044b (<code>| then | when_all | upon_error<\/code>), \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u044e\u0449\u0438\u0435 \u0441\u0442\u0440\u043e\u0438\u0442\u044c \u0433\u0438\u0431\u043a\u0438\u0435 DAG(Directed Acyclic Graph) \u0437\u0430\u0434\u0430\u0447\u0438<\/p>\n<\/li>\n<li>\n<p>\u041a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043e\u0442\u043c\u0435\u043d\u044b \u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u043e\u0448\u0438\u0431\u043e\u043a \u043a\u0430\u043a \u043d\u0435\u043e\u0442\u044a\u0435\u043c\u043b\u0435\u043c\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u043f\u0430\u0439\u043f\u043b\u0430\u0439\u043d\u0430 (<code>set_stopped, upon_error<\/code>) <\/p>\n<\/li>\n<li>\n<p>\u0418\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u044e \u043a\u043e\u0440\u0443\u0442\u0438\u043d (<code>co_await<\/code><strong> <\/strong>sender) \u0438 \u043f\u0435\u0440\u0435\u0434\u0430\u0447\u0443 scheduler \u0432 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b (<code>std::for_each<\/code>)<\/p>\n<\/li>\n<\/ul>\n<p>\u0427\u0442\u043e\u0431\u044b \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0438 \u0440\u0430\u0437\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f \u0441 \u043f\u0440\u0435\u0434\u0441\u0442\u043e\u044f\u0449\u0438\u043c\u0438 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f\u043c\u0438, \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435:<\/p>\n<ul>\n<li>\n<p>\u0420\u0430\u0437\u0431\u0435\u0440\u0451\u043c \u0442\u0440\u0438 \u043a\u043b\u044e\u0447\u0435\u0432\u044b\u0435 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438: <strong>Scheduler<\/strong>, <strong>Sender<\/strong>, <strong>Receiver<\/strong>.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0433\u043e\u0432\u043e\u0440\u0438\u043c \u043e\u0431 \u0438\u043d\u0441\u043f\u0435\u043a\u0446\u0438\u0438 \u043a\u043e\u0434\u0430 (<code>completion_signatures_of_t<\/code>).<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0430\u043b\u0438\u0437\u0443\u0435\u043c \u043f\u0440\u043e\u0444\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0447\u0435\u0440\u0435\u0437 <code>tag_invoke<\/code>.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0431\u044a\u0435\u0434\u0438\u043d\u0438\u043c \u0432\u0441\u0451 \u044d\u0442\u043e \u0432 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0445 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0441 NVIDIA stdexec.<\/p>\n<\/li>\n<\/ul>\n<figure class=\"full-width\"><\/figure>\n<hr\/>\n<h3>\u041f\u043e\u0447\u0435\u043c\u0443 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u043b\u0441\u044f \u043d\u043e\u0432\u044b\u0439 \u0438 \u0435\u0434\u0438\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434?<\/h3>\n<p>\u041f\u043e\u043f\u044b\u0442\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u044c \u0432 C++ \u043f\u0440\u0435\u0434\u043f\u0440\u0438\u043d\u0438\u043c\u0430\u043b\u0438\u0441\u044c \u0434\u0430\u0432\u043d\u043e \u2014 \u0438 \u043d\u0435 \u0432\u0441\u0435\u0433\u0434\u0430 \u0443\u0434\u0430\u0447\u043d\u043e. \u0414\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f Senders\/Receivers \u0421++ \u043e\u043f\u0438\u0440\u0430\u043b\u0441\u044f \u043d\u0430 \u0442\u0430\u043a\u0438\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b, \u043a\u0430\u043a <code>std::async<\/code>, <code>std::future<\/code>, Boost.Asio \u0438 \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b <code>co_await<\/code>. \u041e\u043d\u0438 \u043f\u043e\u043c\u043e\u0433\u0430\u043b\u0438 \u0440\u0435\u0448\u0430\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0438, \u043d\u043e \u043f\u043e \u043c\u0435\u0440\u0435 \u0440\u043e\u0441\u0442\u0430 \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438\u0441\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u0438\u044f, \u043c\u0435\u0448\u0430\u044e\u0449\u0438\u0435 \u0438\u0445 \u044d\u0444\u0444\u0435\u043a\u0442\u0438\u0432\u043d\u043e\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u0438\u044e \u0432 \u0440\u0435\u0430\u043b\u044c\u043d\u044b\u0445 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u044f\u0445.<\/p>\n<p>\u041f\u043e\u044f\u0432\u0438\u0432\u0448\u0438\u0441\u044c \u0432 C++11, <code>std::async<\/code> \u0438 <code>std::future<\/code> \u0441\u0442\u0430\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u043c \u0448\u0430\u0433\u043e\u043c \u043a \u0443\u0434\u043e\u0431\u043d\u043e\u0439 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0441\u0442\u0438 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u0430. \u041e\u0434\u043d\u0430\u043a\u043e \u044d\u0442\u0438 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0431\u044b\u0441\u0442\u0440\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043b\u0438 \u0441\u0432\u043e\u044e \u043d\u0435\u0441\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445:<\/p>\n<ul>\n<li>\n<p>\u041d\u0435\u043b\u044c\u0437\u044f \u0432\u044b\u0440\u0430\u0437\u0438\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0430\u0434\u0430\u0447 \u0434\u0435\u043a\u043b\u0430\u0440\u0430\u0442\u0438\u0432\u043d\u043e, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432\u0440\u0443\u0447\u043d\u0443\u044e \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c <code>get()<\/code> \u0438 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p>E\u0441\u043b\u0438 \u0437\u0430\u0434\u0430\u0447\u0430 \u0443\u0436\u0435 \u0437\u0430\u043f\u0443\u0449\u0435\u043d\u0430 \u2014 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0435\u0451 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043d\u0435\u0442 \u043f\u0440\u0435\u0434\u0443\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u043e\u0442\u043c\u0435\u043d\u044b;<\/p>\n<\/li>\n<li>\n<p>\u041e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 \u0441 \u043f\u043b\u0430\u043d\u0438\u0440\u043e\u0432\u0449\u0438\u043a\u0430\u043c\u0438 \u0438 I\/O: \u043d\u0435\u043b\u044c\u0437\u044f \u0437\u0430\u0434\u0430\u0442\u044c, \u0433\u0434\u0435 \u0438\u043c\u0435\u043d\u043d\u043e \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0437\u0430\u0434\u0430\u0447\u0443, \u0438\u043b\u0438 \u043f\u0440\u0438\u0432\u044f\u0437\u0430\u0442\u044c \u043a \u0441\u043e\u0431\u044b\u0442\u0438\u044f\u043c \u0432\u0432\u043e\u0434\u0430-\u0432\u044b\u0432\u043e\u0434\u0430;<\/p>\n<\/li>\n<li>\n<p>\u041d\u0435\u0442 \u043f\u043e\u043b\u043d\u043e\u0446\u0435\u043d\u043d\u043e\u0439 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a, \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 <code>future::get()<\/code>, \u0447\u0442\u043e \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u0445\u0430\u043e\u0441 \u0432 \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0435 \u043f\u043e\u0442\u043e\u043a\u0430 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f;<\/p>\n<\/li>\n<li>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0434\u043d\u043e\u0439 \u0437\u0430\u0434\u0430\u0447\u0438 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0435\u0440\u0435\u0434\u0430\u0442\u044c \u0434\u0440\u0443\u0433\u043e\u0439 \u0431\u0435\u0437 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u043e\u0432 \u0438 \u0431\u043e\u0439\u043b\u0435\u0440\u043f\u043b\u0435\u0439\u0442\u0430.<\/p>\n<\/li>\n<li>\n<p>\u0418, \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430, \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0430\u0442\u044c \u0435\u0449\u0435 \u0434\u043e\u043b\u0433\u043e, \u043f\u043e\u0441\u0442\u0435\u043f\u0435\u043d\u043d\u043e \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u044f\u0441\u044c \u0432 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438&#8230;<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u043e\u0442 \u0436\u0435 Boost.Asio \u043e\u0431\u0435\u0441\u043f\u0435\u0447\u0438\u043b \u0432\u044b\u0441\u043e\u0447\u0430\u0439\u0448\u0443\u044e \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0432 I\/O, \u043d\u043e \u0440\u0430\u0441\u043f\u043b\u0430\u0442\u043e\u0439 \u0437\u0430 \u044d\u0442\u043e \u0441\u0442\u0430\u043b\u0430 \u043a\u0440\u0430\u0439\u043d\u0435 \u043d\u0438\u0437\u043a\u0430\u044f \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c. \u041a\u043e\u043c\u043f\u043e\u0437\u0438\u0446\u0438\u044f \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \u0441\u0442\u0440\u043e\u0438\u0442\u0441\u044f \u0447\u0435\u0440\u0435\u0437 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0435 \u043b\u044f\u043c\u0431\u0434\u044b \u2014 \u043e\u0442\u0441\u044e\u0434\u0430 \u0438 &#171;callback hell&#187;. \u042d\u0442\u043e \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u044f\u0435\u0442 \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443, \u043d\u043e \u0438 \u043b\u044e\u0431\u0443\u044e \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u0437\u0430\u0446\u0438\u044e:<\/p>\n<pre><code class=\"cpp\">async_read(..., [&amp;](...) {   async_write(..., [&amp;](...) {     async_timer(..., [&amp;](...) {       \/\/ \u0414\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0431\u043e\u043b\u044c\u043d\u043e     });   }); });<\/code><\/pre>\n<p>\u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435\u043c \u0437\u0430\u0434\u0430\u0447\u0438 (\u043e\u0448\u0438\u0431\u043a\u0438, \u043e\u0442\u043c\u0435\u043d\u0430, \u0441\u0431\u043e\u0438) \u043f\u0435\u0440\u0435\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043f\u043b\u0435\u0447\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 (\u043d\u0430\u0434\u0435\u0436\u043d\u043e, \u043a\u0430\u043a \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0432 C++) .<\/p>\n<p>\u0421 \u0432\u0432\u0435\u0434\u0435\u043d\u0438\u0435\u043c <code>co_await<\/code> \u0432 C++20 \u043f\u043e\u044f\u0432\u0438\u043b\u0430\u0441\u044c \u043d\u0430\u0434\u0435\u0436\u0434\u0430 \u2014 \u0438\u043c\u043f\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u0439 \u0441\u0442\u0438\u043b\u044c \u0432\u0435\u0440\u043d\u0443\u043b\u0441\u044f \u0432 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. \u041d\u043e \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u043a\u043e\u0440\u0443\u0442\u0438\u043d\u044b: \u043d\u0435 \u0443\u043c\u0435\u044e\u0442 \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e &#171;\u043f\u043e\u043d\u0438\u043c\u0430\u0442\u044c&#187; <code>std::future<\/code> \u0438\u043b\u0438 <code>asio::awaitable<\/code>; \u043d\u0435 \u043a\u043e\u043c\u043f\u043e\u0437\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u043c\u0435\u0436\u0434\u0443 \u0441\u043e\u0431\u043e\u0439 \u0431\u0435\u0437 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0439 \u0438\u043d\u0444\u0440\u0430\u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u044b; \u043d\u0435 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u044e\u0442\u0441\u044f \u0441 <code>scheduler<\/code> \u0438\u043b\u0438 I\/O \u0431\u0435\u0437 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0445 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u043e\u0432; \u0438\u043c\u0435\u044e\u0442 \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u0430 lifetime \u0438 \u0441\u043b\u043e\u0436\u043d\u044b\u0435 \u0441\u0435\u043c\u0430\u043d\u0442\u0438\u043a\u0438 \u043e\u0442\u043c\u0435\u043d\u044b.<\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 Senders\/Receivers &#8212; \u044d\u0442\u043e \u0441\u0438\u0441\u0442\u0435\u043c\u043d\u044b\u0439 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0441\u0442\u044c \u0438 \u0440\u0430\u0437\u043e\u0431\u0449\u0451\u043d\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0434\u0445\u043e\u0434\u043e\u0432 \u043a \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u043c\u0443 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044e \u0432 C++, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0438\u0440\u0443\u0435\u0442 \u0438\u0445 \u0432 \u0435\u0434\u0438\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443, \u0441\u043f\u043e\u0441\u043e\u0431\u043d\u0443\u044e \u043c\u0430\u0441\u0448\u0442\u0430\u0431\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u0442 \u043e\u0434\u043d\u043e\u043f\u043e\u0442\u043e\u0447\u043d\u043e\u0433\u043e embedded-\u043a\u043e\u0434\u0430 \u0434\u043e \u0440\u0435\u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0445 \u043c\u0438\u043a\u0440\u043e\u0441\u0435\u0440\u0432\u0438\u0441\u043e\u0432 \u0438 GPU-\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0434\u0430\u043d\u043d\u044b\u0445.<\/p>\n<hr\/>\n<h3>\u0410\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0430 Senders\/Receivers (\u0441 \u0447\u0435\u0433\u043e \u0432\u0441\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442\u0441\u044f)<\/h3>\n<p>\u041d\u043e\u0432\u0430\u044f \u043c\u043e\u0434\u0435\u043b\u044c \u0431\u0430\u0437\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0442\u0440\u0451\u0445 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u044f\u0445:<\/p>\n<p><strong>1) Scheduler<\/strong> \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442 <em>\u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442<\/em> \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (thread-pool, inline, I\/O-\u0440\u0435\u0430\u043a\u0442\u043e\u0440) \u0431\u0435\u0437 \u0436\u0451\u0441\u0442\u043a\u043e\u0439 \u043f\u0440\u0438\u0432\u044f\u0437\u043a\u0438 \u043a \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438. \u041d\u0430\u0433\u043b\u044f\u0434\u043d\u044b\u0435 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438:<\/p>\n<ul>\n<li>\n<p><code>inline_scheduler<\/code> \u2014 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0438 \u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e \u0441\u0440\u0430\u0437\u0443,<\/p>\n<\/li>\n<li>\n<p><code>static_thread_pool::scheduler<\/code> \u0438\u0437 NVIDIA stdexec,<\/p>\n<\/li>\n<li>\n<p><code>reactor_scheduler<\/code> (I\/O \u043d\u0430 <code>io_uring<\/code>),<\/p>\n<\/li>\n<li>\n<p>\u043f\u043e \u0445\u0430\u0431\u0430\u043c \u0440\u0430\u0437\u0431\u0440\u043e\u0441\u0430\u043d\u044b \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u0441\u043a\u0438\u0435 GPU\/GUI schedulers.<\/p>\n<\/li>\n<\/ul>\n<p><strong>2) Sender<\/strong> \u2014 \u043b\u0435\u043d\u0438\u0432\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0439 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438. \u041e\u043d <strong>\u043d\u0435 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442<\/strong> \u0440\u0430\u0431\u043e\u0442\u0443, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d \u0438\u043b\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0434\u0430\u043d \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0443:<\/p>\n<ul>\n<li>\n<p><strong>Single-value senders<\/strong>: <code>sync_wait<\/code>, <code>just<\/code>, <code>then<\/code>, <code>co_await sender<\/code>.<\/p>\n<\/li>\n<li>\n<p><strong>Multi-value senders<\/strong>: <code>when_all<\/code>, <code>when_any<\/code>, <code>when_all_range<\/code>.<\/p>\n<\/li>\n<\/ul>\n<p>\u041a\u0430\u043a \u044d\u0442\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u0417\u0430 \u043a\u0443\u043b\u0438\u0441\u0430\u043c\u0438 Senders\/Receivers \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u044b \u0434\u0432\u0430 \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u0445 CPO (\u0440\u0430\u0432\u043d\u043e \u043a\u0430\u043a \u0438 \u0432 coroutine interop (<a href=\"https:\/\/open-std.org\/jtc1\/sc22\/wg21\/docs\/papers\/2024\/p3109r0.html\" rel=\"noopener noreferrer nofollow\">&#171;P3109R0&#187;<\/a>)):<\/p>\n<ul>\n<li>\n<p><code><strong>std::execution::connect(Sender, Receiver)<\/strong><\/code> \u2014 \u0441\u0432\u044f\u0437\u044b\u0432\u0430\u0435\u0442 sender \u0438 receiver, \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u044f \u00aboperation state\u00bb (\u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438) \u0431\u0435\u0437 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0437\u0430\u0434\u0430\u0447\u0438<\/p>\n<\/li>\n<li>\n<p><code><strong>std::execution::start(OperationState&amp;)<\/strong><\/code> \u2014 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442 \u0443\u0436\u0435 \u0441\u043a\u043e\u043d\u0441\u0442\u0440\u0443\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u0443\u044e \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e, \u043f\u0435\u0440\u0435\u0432\u043e\u0434\u044f \u0435\u0451 \u0432 \u0430\u043a\u0442\u0438\u0432\u043d\u044b\u0439 \u0440\u0435\u0436\u0438\u043c \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0441\u043c\u0435\u043b\u043e \u043e\u0442\u043b\u043e\u0436\u0438\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a \u0437\u0430\u0434\u0430\u0447\u0438 \u0434\u043e \u043f\u043e\u043b\u043d\u043e\u0439 \u043a\u043e\u043c\u043f\u043e\u043d\u043e\u0432\u043a\u0438 \u0433\u0440\u0430\u0444\u0430 \u0437\u0430\u0434\u0430\u0447, \u0430\u0433\u0440\u0435\u0433\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u0438 (\u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u0430\u044f \u043f\u0430\u043c\u044f\u0442\u044c \u0434\u043b\u044f \u0432\u0441\u0435\u0445 operation state) \u0438 \u043d\u0430\u0441\u0442\u0440\u043e\u0438\u0442\u044c \u043e\u0442\u043c\u0435\u043d\u0443 (\u0447\u0435\u0440\u0435\u0437 <code>get_stop_token<\/code>) \u0434\u043e \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u0442\u0430. <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u0432\u0441\u0451 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u043e\u0441\u044c \u0441\u0440\u0430\u0437\u0443, \u043c\u044b \u043f\u043e\u0442\u0435\u0440\u044f\u043b\u0438 \u0431\u044b \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044c \u043d\u0430\u0434 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0435\u0439 \u043a\u043e\u043d\u0442\u0435\u043a\u0441\u0442\u0430, \u043e\u0442\u043c\u0435\u043d\u043e\u0439 \u0438 \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u0435\u043d\u0438\u0435\u043c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 senders \u0432 DAG.<\/p>\n<p><strong>3) Receiver<\/strong> \u2014 \u044d\u0442\u043e \u043a\u043e\u043b\u043b\u0431\u044d\u043a \u0441 \u0442\u0440\u0435\u043c\u044f \u043a\u0430\u043d\u0430\u043b\u0430\u043c\u0438:<\/p>\n<ul>\n<li>\n<p><code>set_value(v\u2026)<\/code> \u043f\u0440\u0438 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435,<\/p>\n<\/li>\n<li>\n<p><code>set_error(exception_ptr)<\/code> \u043f\u0440\u0438 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0438,<\/p>\n<\/li>\n<li>\n<p><code>set_stopped()<\/code> \u043f\u0440\u0438 \u043e\u0442\u043c\u0435\u043d\u0435.<\/p>\n<\/li>\n<\/ul>\n<p>\u0418, \u043a\u0443\u0434\u0430 \u0436\u0435 \u0431\u0435\u0437 \u043d\u0438\u0445, \u0440\u0430\u0437\u043d\u044b\u0435 \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u044b:<\/p>\n<ul>\n<li>\n<p><code><strong>just(v\u2026)<\/strong><\/code> \u0441\u043e\u0437\u0434\u0430\u0451\u0442 sender, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u0434\u0430\u0451\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043f\u0440\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u043a\u0435.<\/p>\n<\/li>\n<li>\n<p><code><strong>read_env(get_scheduler)<\/strong><\/code> \u0438\u0437\u0432\u043b\u0435\u043a\u0430\u0435\u0442 <code>scheduler<\/code> \u0438\u0437 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<li>\n<p><code><strong>then(sender, func)<\/strong><\/code> \u2014 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 sender (\u043c\u043e\u0436\u043d\u043e \u0438 \u043e\u0442 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0435\u0433\u043e \u0430\u0434\u0430\u043f\u0442\u0435\u0440\u0430) \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043e\u0431\u044b\u0447\u043d\u043e\u0435 \u0433\u043e\u0442\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 (\u0438\u043b\u0438 tuple \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439), \u0438 \u0437\u0430\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u044d\u0442\u043e\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0432 \u043d\u043e\u0432\u044b\u0439 sender (\u0435\u0441\u043b\u0438 \u0437\u0432\u0430\u0442\u044c \u043f\u043e\u0434\u0440\u044f\u0434 &#8212; \u0431\u0443\u0434\u0435\u0442 sender&lt;sender&lt;int&gt;&gt; \u0438 \u0442.\u0434. :<\/p>\n<p>auto s = just( 10 ) | then( []( int x ) { return x * 2; } ); &#8212; \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0442\u0440\u0430\u043d\u0441\u0444\u043e\u0440\u043c\u0435\u0440<\/p>\n<\/li>\n<li>\n<p><code><strong>let_value(sender, func)<\/strong><\/code> \u2014 \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u043e\u0435 \u043f\u0440\u043e\u0434\u043e\u043b\u0436\u0435\u043d\u0438\u0435, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0442\u0430\u043a\u0436\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <em>sender, \u043d\u043e \u043d\u0435 \u0443\u0433\u043b\u0443\u0431\u043b\u044f\u044f \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u043e\u0441\u0442\u044c<\/em>. \u0422\u0440\u0435\u0431\u0443\u0435\u0442, \u0447\u0442\u043e\u0431\u044b <code><strong>func<\/strong><\/code><strong> <\/strong>\u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u043b<strong> <\/strong><code><strong>sender<\/strong><\/code>(\u0434\u0440\u0443\u0433\u0443\u044e \u0430\u0441\u0438\u043d\u0445\u0440\u043e\u043d\u043d\u0443\u044e \u0440\u0430\u0431\u043e\u0442\u0443), \u0438 \u00ab\u0440\u0430\u0441\u043a\u0440\u044b\u0432\u0430\u0435\u0442\u00bb \u0435\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e, \u043e\u0431\u044a\u0435\u0434\u0438\u043d\u044f\u044f \u0434\u0432\u0430 \u0448\u0430\u0433\u0430 \u0432 \u043e\u0434\u0438\u043d DAG-\u0443\u0437\u0435\u043b.<\/p>\n<\/li>\n<li>\n<p><code><strong>when_all(s1,s2,\u2026)<\/strong><\/code> \u2014 \u0436\u0434\u0451\u0442 \u0432\u0441\u0435\u0445 senders, \u043e\u0442\u0434\u0430\u0451\u0442 <code>set_value(v1,v2,\u2026)<\/code>.<\/p>\n<\/li>\n<li>\n<p><code><strong>when_any(s1,s2,\u2026)<\/strong><\/code> \u2014 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0435\u0440\u0432\u044b\u043c.<\/p>\n<\/li>\n<li>\n<p><code><strong>when_all_range(container)<\/strong><\/code> \u2014 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442 run-time \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u044e senders.<\/p>\n<\/li>\n<li>\n<p><code><strong>sync_wait<\/strong><\/code> &#8212; \u0431\u043b\u043e\u043a\u0438\u0440\u0443\u044e\u0449\u0438\u0439 \u0432\u044b\u0437\u043e\u0432, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u044e\u0449\u0438\u0439 <code>optional&lt;tuple&lt;...&gt;&gt;<\/code> (\u043f\u0443\u0441\u0442\u043e\u0439 \u043f\u0440\u0438 \u043e\u0448\u0438\u0431\u043a\u0435 \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0435)<\/p>\n<\/li>\n<\/ul>\n<p>\u041f\u043e \u0445\u043e\u0434\u0443 \u0441\u0442\u0430\u0442\u044c\u0438 \u044f \u0431\u0443\u0434\u0443 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u044b, \u043f\u043e\u043f\u0443\u0442\u043d\u043e \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u044f \u0431\u043e\u043b\u044c\u0448\u0443\u044e \u0447\u0430\u0441\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0414\u043b\u044f \u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u043e\u0432 \u0431\u0443\u0434\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0444\u0435\u0440\u0435\u043d\u0441\u043d\u0443\u044e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044e NVIDIA <code>stdexec<\/code>, \u043f\u043e\u043a\u0430 <code>&lt;execution&gt;<\/code> \u043d\u0435 \u043f\u043e\u044f\u0432\u0438\u0442\u0441\u044f \u0432 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0435.<\/p>\n<p>\u041d\u0430\u0447\u043d\u0435\u043c \u0437\u043d\u0430\u043a\u043e\u043c\u0441\u0442\u0432\u043e \u0441 \u043c\u0430\u043b\u043e\u0433\u043e, \u0438 \u043f\u0435\u0440\u0435\u0432\u0435\u0434\u0435\u043c \u0441\u043b\u043e\u0432\u0430 \u0432 \u0432\u0435\u0440\u0445\u043d\u0438\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440:<\/p>\n<pre><code class=\"cpp\">#include &lt;iostream&gt; #include &lt;stdexec\/execution.hpp&gt; #include &lt;string&gt;  namespace ex = stdexec;  int main() {    \/\/ \u0421\u043e\u0437\u0434\u0430\u0435\u043c sender \u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u043e\u043c just, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u0440\u0430\u0437\u0443 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0442\u0440\u043e\u043a\u0443 \"Hello\"    auto sender = ex::just( std::string( \"Hello\" ) ) |                  ex::then(                     []( auto&amp;&amp; s )                     {                        for( auto&amp; c : s )                           c = std::toupper( c );                        return s;                         \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 sender&lt;std::string&gt;                     } ) |                  ex::let_value(                     []( std::string s )                     {                        return ex::just( s + \"!\" );                         \/\/ \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 sender&lt;std::string&gt;                     } );     auto result = ex::sync_wait( sender );     \/\/ sync_wait \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 connect+start     if( result )    {       auto [ str ] = result.value(); \/\/ \u0420\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0430 \u043a\u043e\u0440\u0442\u0435\u0436\u0430       std::cout &lt;&lt; \"\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442: \" &lt;&lt; str &lt;&lt; std::endl;    } }<\/code><\/pre>\n<p><strong>1) <\/strong><code>ex::just(\"Hello\")<\/code> \u0441\u0440\u0430\u0437\u0443 \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u0442 \u0434\u0430\u043b\u044c\u0448\u0435 \u043f\u043e \u0433\u0440\u0430\u0444\u0443 \u0437\u0430\u0434\u0430\u0447 \u0441\u0442\u0440\u043e\u043a\u0443 <code>\"Hello\"<\/code>, \u043e\u0431\u043b\u0435\u0447\u0435\u043d\u043d\u0443\u044e \u0432 sender -&gt; (sender&lt;std::string&gt;).<\/p>\n<p><strong>2) <\/strong>\u041f\u0435\u0440\u0432\u044b\u0439<strong> <\/strong><code>then<\/code> \u0431\u0435\u0440\u0451\u0442 \u044d\u0442\u0443 \u0441\u0442\u0440\u043e\u043a\u0443 \u0447\u0435\u0440\u0435\u0437 forwarding <code>auto&amp;&amp;<\/code>, \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u0442 \u0435\u0451 \u0438 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 <strong>\u043f\u0440\u043e\u0441\u0442\u043e \u0441\u0442\u0440\u043e\u043a\u0443<\/strong>. \u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043f\u043e\u0441\u043b\u0435 \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u0443 \u043d\u0430\u0441 \u043f\u043e-\u043f\u0440\u0435\u0436\u043d\u0435\u043c\u0443 <code>sender&lt;std::string&gt;<\/code>.<\/p>\n<p><strong>3) <\/strong><code>let_value<\/code>  \u0432\u0438\u0434\u0438\u0442, \u0447\u0442\u043e \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0435\u043d <code>sender<\/code>, \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u044b\u0432\u0430\u0435\u0442 \u0432\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 sender \u0438 \u0434\u0435\u043b\u0430\u0435\u0442 \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u043e\u043d \u0441\u0442\u0430\u043b \u0447\u0430\u0441\u0442\u044c\u044e \u043e\u0431\u0449\u0435\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0438. \u0412 \u0438\u0442\u043e\u0433\u0435 <code>sender<\/code> \u0432\u044b\u0434\u0430\u0451\u0442 \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e <code>\"HELLO!\"<\/code> \u0447\u0435\u0440\u0435\u0437 <code>set_value<\/code>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u0431\u044b \u0432\u043c\u0435\u0441\u0442\u043e <code>let_value<\/code> \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0441\u044f <code>then<\/code>, \u0442\u043e \u043b\u044f\u043c\u0431\u0434\u0430 <code>[](std::string s){ return ex::just(s + \"!\"); }<\/code> \u0432\u0435\u0440\u043d\u0443\u043b\u0430 \u0431\u044b <code>sender&lt;std::string&gt;<\/code>, \u0438 <code>then<\/code> \u0443\u043f\u0430\u043a\u043e\u0432\u0430\u043b \u0431\u044b \u0435\u0433\u043e \u043a\u0430\u043a <strong>\u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/strong>, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0441\u0442\u0430\u043b\u043e \u0431\u044b <code>sender&lt;sender&lt;std::string&gt;&gt;<\/code>, \u0447\u0442\u043e \u043d\u0435 \u0442\u043e, \u0447\u0435\u0433\u043e \u043c\u044b \u0445\u043e\u0442\u0438\u043c.<\/p>\n<p>\u0421\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043f\u043e\u0439\u0434\u0435\u043c \u0447\u0435\u0440\u0435\u0437 \u043f\u0443\u043b \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0441\u043b\u043e\u0432 \u0432 \u0444\u0430\u0439\u043b\u0430\u0445, \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0443 \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 \u0438 \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u044b\u0439 \u043f\u043e\u0434\u0441\u0447\u0435\u0442 \u0441\u043b\u043e\u0432.<\/p>\n<pre><code class=\"cpp\">\/\/ NVIDIA-\u043f\u0443\u043b \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0434\u043b\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u0430 #include &lt;exec\/static_thread_pool.hpp&gt;  #include &lt;fstream&gt; #include &lt;iostream&gt; #include &lt;stdexec\/execution.hpp&gt;  namespace ex = stdexec;  int main() {    \/\/ \u0421\u043e\u0437\u0434\u0430\u0451\u043c NVIDIA-\u043f\u0443\u043b \u0438\u0437 3 \u043f\u043e\u0442\u043e\u043a\u043e\u0432 \u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0435\u0433\u043e scheduler:    exec::static_thread_pool pool{ 3 };    auto sched = pool.get_scheduler();     \/\/ \u041c\u0438\u043d\u0438-\u0444\u0430\u0431\u0440\u0438\u043a\u0430 sender-\u043e\u0432, \u043a\u0430\u0436\u0434\u044b\u0439 \u0441\u0447\u0438\u0442\u0430\u0435\u0442 \u0441\u043b\u043e\u0432\u0430 \u0432 \u0441\u0432\u043e\u0451\u043c \u0444\u0430\u0439\u043b\u0435:    auto make_count = [ &amp;sched ]( std::string path )    {  \/\/     \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u043c\u0441\u044f \u0432 pool       return ex::schedule( sched )               \/\/ \u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u043f\u0443\u0442\u044c              | ex::then( [ p = std::move( path ) ] { return p; } )              | ex::then(                   []( std::string&amp;&amp; p ) -&gt; size_t                   {                      \/\/ \u0447\u0438\u0442\u0430\u0435\u043c \u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0441\u043b\u043e\u0432\u0430                      std::ifstream in( p );                       if( !in ) \/\/ \u0432\u044b\u0431\u0440\u043e\u0441\u0438\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435, \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043d\u0438\u0436\u0435                         throw std::runtime_error( \"Cannot open: \" + p );                       size_t cnt = 0;                      std::string w;                      while( in &gt;&gt; w )                         ++cnt;                      std::cout &lt;&lt; \"Count in \" &lt;&lt; p &lt;&lt; \" = \" &lt;&lt; cnt &lt;&lt; std::endl;                       return cnt;                   } ) |               ex::upon_error( \/\/ \u043d\u0430\u0448 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u043f\u043e \u0432\u0441\u0435\u043c \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u044f\u043c                 []( std::exception_ptr ep ) -&gt; size_t                 {                   \/\/ \u0415\u0441\u043b\u0438 \u0432 \u043b\u044e\u0431\u043e\u043c \u0448\u0430\u0433\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0448\u043b\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435                    \/\/ upon_error \u0432\u0435\u0440\u043d\u0451\u0442 0, \u0438 sync_wait \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e.                    try           <\/code><\/pre>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-457267","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/457267","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=457267"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/457267\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=457267"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=457267"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=457267"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}