9 Star 34 Fork 10

linuxmail / lib-zo

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
sleep_test.c 791 Bytes
一键复制 编辑 原始数据 按行查看 历史
linuxmail 提交于 2021-11-16 15:23 . memleak
/*
* ================================
* eli960@qq.com
* http://linuxmail.cn/
* 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();
zcoroutine_base_fini();
return 0;
}
C
1
https://gitee.com/linuxmail/lib-zo.git
git@gitee.com:linuxmail/lib-zo.git
linuxmail
lib-zo
lib-zo
master

搜索帮助