Хабр Курсы для всех
РЕКЛАМА
Практикум, Хекслет, SkyPro, авторские курсы — собрали всех и попросили скидки. Осталось выбрать!
Понятно, что некоторые пакеты обслуживаются быстро, а иные могут потребовать много времени. В такой ситуации хотелось бы иметь механизм, который динамически порождает обслуживающие нити по мере необходимости, и механизм достаточно дешёвый в ситуации, когда лишние нити не нужны
что это довольно дорого, потому что надо переключать контексты
cpc_detach, cpc_attach The cpc_detach statement detaches the current continuation; the following statements are executed in a dedicated native thread. The opposite operation is performed by cpc_attach, which causes the current continuation to be scheduled by the CPC scheduler.
The cpc_detach and cpc_attach statements can only appear in cpc context.
cpc_detached, cpc_attached The body of a cpc_detached statement is run detached: an implicit cpc_detach is executed upon entering the body, and a cpc_attach is executed upon exiting. The cpc_attached construct is dual: a cpc_attach is executed upon entry, and a cpc_detach is executed upon exit
Lazy threads: опциональный параллелизм