1 Star 0 Fork 11

Ayrz/lib-zo

forked from linuxmail/lib-zo 
加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
sleep_test.c 800 Bytes
一键复制 编辑 原始数据 按行查看 历史
linuxmail 提交于 2020-01-02 15:06 +08:00 . include
/*
* ================================
* eli960@qq.com
* https://blog.csdn.net/eli960
* 2017-07-02
* ================================
*/
#include "coroutine.h"
#include <stdio.h>
#include <unistd.h>
static void *test_sleep1(void *context)
{
while(1){
sleep(1);
zcoroutine_sleep_millisecond(10);
printf("test_sleep1, 1s + 10ms \n");
}
return context;
}
static void *test_sleep2(void *context)
{
while(1){
sleep(2);
zcoroutine_sleep_millisecond(300);
printf("test_sleep2, 2s + 300ms \n");
}
return context;
}
int main(int argc, char **argv)
{
zcoroutine_base_init();
zcoroutine_go(test_sleep1, 0, 0);
zcoroutine_go(test_sleep2, 0, 0);
zcoroutine_base_run(0);
zcoroutine_base_fini();
return 0;
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
C
1
https://gitee.com/ayrz2010/lib-zo.git
git@gitee.com:ayrz2010/lib-zo.git
ayrz2010
lib-zo
lib-zo
master

搜索帮助