Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
1,069 additions
and
963 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
--- | ||
weight: 2 | ||
title: "联系" | ||
--- | ||
|
||
**联系方式** | ||
|
||
- Email: idealvin@qq.com | ||
- github: [https://github.com/idealvin/co](https://github.com/idealvin/co) | ||
- gitee: [https://gitee.com/idealvin/co](https://gitee.com/idealvin/co) | ||
- zhihu: [idealvin](https://www.zhihu.com/people/vin.cc) | ||
|
||
CO 目前有一个技术交流微信群,有兴趣加群的朋友,可以给 Alvin 发邮件,或在知乎上私信 idealvin。 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
--- | ||
weight: 3 | ||
title: "赞助💕" | ||
--- | ||
|
||
|
||
## 赞助 | ||
|
||
CO 是一个个人项目,如果您有意向赞助 CO,可以联系 Alvin(idealvin@qq.com),我们将会在这里展示您的 logo、网址等信息,同时将为您提供更好的技术服务。非常感谢🙏 | ||
|
||
|
||
|
||
|
||
## 咖啡 | ||
|
||
如果您喜欢 CO,也可以考虑给作者来杯咖啡,非常感谢🙏 | ||
|
||
|
||
- 微信 | ||
|
||
![wx.png](/images/wx.png) | ||
|
||
|
||
- 支付宝 | ||
|
||
![zfb.png](/images/zfb.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
weight: 2 | ||
title: "defer" | ||
--- | ||
|
||
include: [co/defer.h](https://github.com/idealvin/co/blob/master/include/co/defer.h). | ||
|
||
|
||
## defer | ||
|
||
`defer` 是 CO 提供的一个宏,它实现了类似 golang 中 defer 的功能。 | ||
|
||
```cpp | ||
#include "co/defer.h" | ||
#include "co/time.h" | ||
#include "co/log.h" | ||
#include "co/json.h" | ||
|
||
void f(const Json& req, Json& res) { | ||
Timer t; | ||
LOG << "req: " << req; | ||
defer(LOG << "res: " << res << ", time elapse: " << t.us() << "us"); | ||
|
||
// do something here | ||
} | ||
``` | ||
上面的例子中,`defer` 中的代码将在函数 `f` 结束时执行,从而打印出函数的输出及调用时间。 |
Oops, something went wrong.