From ba6f79c39c2a3ad82ee6451d61ba343f704668e5 Mon Sep 17 00:00:00 2001 From: xiaoquanjie <404558965@qq.com> Date: Sun, 3 Jul 2022 11:59:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E6=B7=BB=E5=8A=A0async=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/README.md b/README.md index e2abdb5..6f1d045 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,7 @@ code first:(10行以内的代码展示项目) * [ScriptX](#ScriptX) * [CppMediaServer](#CppMediaServer) * [moon](#moon) +* [async](#async) ## 孵化中 @@ -700,3 +701,44 @@ cpp media server是基于c++17开发的webrtc会议服务sfu,并且同时支 * httpflv拉流服务(支持h264/vp8+aac/opus in rtmp/flv) * hls录像服务(支持h264/vp8+aac/opus in mpegts) * webobs: websocket推送flv直播服务(webcodec编码,websocket flv推流封装) + +## async + +项目名称:[async](https://github.com/xiaoquanjie/async) + +状态:已发布 + +需要的C++版本:C++11 + +项目简介: +async的目标是为异步代码的“同步编写”提供一个解决方案。其中内置了一些项目中常用的io接口实现, +比如:mysql,curl,mongo,redis以及基于zeromq而实现的服务端进程间通信。简单易用 + +支持跨平台(linux/windwos) + +code first: + +// 下面代码的输出结果是: +promise begin +异步执行结束 +promise over:0 + +```c++ +void promise_test() { + // 起一个协程任务,回调将在协程里运行 + CoroutineTask::doTask([](void*){ + printf("promise begin\n"); + auto ret = co_async::promise([](co_async::Resolve resolve, co_async::Reject reject) { + // 两秒后执行下面的回调 + co_async::setTimeout([resolve]() { + printf("异步执行结束\n"); + // 报告promise异步执行结束,并传递结果集,这里传nullptr + resolve(nullptr); + }, 2*1000); + }); + // promise返回,往下继续走 + printf("promise over:%d\n", ret.first); + }, 0); +} + +``` \ No newline at end of file From 58a38db6131a2c88b7a75323bf6ff403723fc8bf Mon Sep 17 00:00:00 2001 From: xiaoquanjie <31240446+xiaoquanjie@users.noreply.github.com> Date: Wed, 20 Jul 2022 14:37:33 +0800 Subject: [PATCH 2/2] Update README.md --- README.md | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/README.md b/README.md index a1ecd47..2210477 100644 --- a/README.md +++ b/README.md @@ -675,34 +675,6 @@ try { 5. API强类型 -## CppMediaServer - -项目名称:[Cpp Media Server](https://github.com/runner365/cpp_media_server) - -状态:已发布 - -需要的C++版本:C++17 - -项目简介: -cpp media server是基于c++17开发的webrtc会议服务sfu,并且同时支持丰富的直播流媒体特性。 - -支持跨平台(linux/mac), 支持多种流媒体协议和封装格式:webrtc/rtmp/httpflv/hls/websocket flv - -### webrtc相关特性 -* 房间管理服务 -* websocket长连接接入 -* 推流/停止推流 -* 拉流/停止拉流 -* 高性能webrtc转rtmp -* 高性能rtmp转webrtc - -### 直播相关特性 -* rtmp推拉流服务(支持h264/vp8+aac/opus in rtmp/flv) -* httpflv拉流服务(支持h264/vp8+aac/opus in rtmp/flv) -* hls录像服务(支持h264/vp8+aac/opus in mpegts) -* webobs: websocket推送flv直播服务(webcodec编码,websocket flv推流封装) - - ## async 项目名称:[async](https://github.com/xiaoquanjie/async)