国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C++ > 正文

c++支持coroutine的簡單示例

2020-01-26 15:34:38
字體:
來源:轉載
供稿:網友

平臺:linux
依賴:g++ supports c++0x

復制代碼 代碼如下:

void func1()
{
    coroutine.yield();
}

void func2(Coro_t co1)
{
    coroutine.resume(co1);   
    coroutine.yield();
}

void func()
{
    Coro_t co1 = coroutine.create(std::bind(&func1));   
    coroutine.resume(co1);   
    Coro_t co2 = coroutine.create(std::bind(&func2, co1));
    coroutine.resume(co2);
    coroutine.resume(co2);
}

int main()
{   
    Coro_t co = coroutine.create(std::bind(&func));
    coroutine.resume(co);
    return 0;
}

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 靖江市| 石泉县| 大港区| 东光县| 曲阳县| 陇西县| 大石桥市| 嘉黎县| 太仓市| 东辽县| 汉寿县| 乌鲁木齐市| 海伦市| 雷州市| 雅安市| 监利县| 尉犁县| 宁都县| 新乐市| 岳西县| 新和县| 正镶白旗| 冀州市| 马尔康县| 蓬莱市| 平罗县| 历史| 曲阳县| 广昌县| 台安县| 闸北区| 宿迁市| 岳普湖县| 革吉县| 景泰县| 瓮安县| 格尔木市| 临湘市| 南投市| 阿合奇县| 阿合奇县|