ПО, ЭВМ и АСУ из Таможенного Союза

Информация о пользователе

Привет, Гость! Войдите или зарегистрируйтесь.



async/await

Сообщений 1 страница 2 из 2

1

Конструкция async/await делает возможной обработку синхронных и асинхронных ошибок с использованием одного и того же механизма — try/catch.

https://habrahabr.ru/post/278267/
   Coroutines belong in a TS
   POSIX Safety Concepts
   Resumable Functions v.2 (MS)
   2009, A Curious Course on Coroutines and Concurrency
   C++ coroutines

https://docs.microsoft.com/ru-ru/dotnet/csharp/async
"пока реализация всего этого сделана поверх потоков, волокон и т.п. — всё работает, как только у нас однопоточная система — всё встаёт колом."

https://twitter.com/Eric01/status/867473461836263424
Coroutines are now in Clang Trunk! Working on the Libc++ implementation now.

Coroutines in LLVM, RFC, 2016-11
    Clang implementation being worked on by Gor Nishanov - the same guy who wrote Microsoft’s implementation
    Gor graduated Moscow State University ( https://events.yandex.ru/lib/people/2954803/ )

opt flag
--enable-coroutines
to try them out
Examples:
https://github.com/llvm-mirror/llvm/tre … Coroutines

Did you install the latest libc++ too? Coroutine header is the magic glue that binds front end and backend implementation and therefore must match the compiler.
You need to pass -stdlib=libc++ -fcoroutines-ts to make everything work.
you need to #include <coroutine> before defining a coroutine
    co_yield, co_return, co_await

примеры кода C/C++

(транспилируем смузи в clang/C++)

Отредактировано Лис (2017-07-09 23:19:26)

0

2

Запустить ~= co_call
Прекратить ~= co_abort (co_throw)
Прерваться ~= co_yield
Продолжить ~= co_resume
Завершиться ~= co_return
Прервать цикл ~= co_break

Ломануться -> break
Вернуться -> continue

Отредактировано Лис (2017-07-10 13:21:40)

0