diff --git a/content/cn/co/atomic.md b/content/cn/co/atomic.md index 955705f..0452690 100644 --- a/content/cn/co/atomic.md +++ b/content/cn/co/atomic.md @@ -3,12 +3,12 @@ weight: 2 title: "原子操作" --- -include: [co/atomic.h](https://github.com/idealvin/co/tree/master/include/co/atomic.h). +include: [co/atomic.h](https://github.com/idealvin/coost/tree/master/include/co/atomic.h). ## Memory Order -co 从 v3.0 开始,增加了对 memory order 的支持。co 中的 6 种 memory order 定义如下: +coost 从 v3.0 开始,增加了对 memory order 的支持。coost 中的 6 种 memory order 定义如下: ```cpp enum memory_order_t { @@ -21,7 +21,7 @@ enum memory_order_t { }; ``` -为了保持兼容性,co 中的原子操作默认的 memory order 均为 `mo_seq_cst`。 +为了保持兼容性,coost 中的原子操作默认的 memory order 均为 `mo_seq_cst`。 diff --git a/content/cn/co/build.md b/content/cn/co/build.md index 52fa26e..1005368 100644 --- a/content/cn/co/build.md +++ b/content/cn/co/build.md @@ -128,7 +128,7 @@ xmake -v #### Android 与 IOS 支持 -CO 在 Android 与 IOS 平台也能编译,详情见 [Github Actions](https://github.com/idealvin/co/actions)。由于作者没有前端开发的经验,暂时未在 Android 与 IOS 上测试。 +CO 在 Android 与 IOS 平台也能编译,详情见 [Github Actions](https://github.com/idealvin/coost/actions)。由于作者没有前端开发的经验,暂时未在 Android 与 IOS 上测试。 - android @@ -148,7 +148,7 @@ xmake -v ### 构建及运行 unitest 代码 -[co/unitest](https://github.com/idealvin/co/tree/master/unitest) 是单元测试代码,可以执行下述命令构建及运行: +[co/unitest](https://github.com/idealvin/coost/tree/master/unitest) 是单元测试代码,可以执行下述命令构建及运行: ```bash xmake -b unitest # build unitest @@ -161,7 +161,7 @@ xmake r unitest -json # 执行单元测试 json ### 构建及运行 test 代码 -[co/test](https://github.com/idealvin/co/tree/master/test) 是一些测试代码,在 co/test 目录或其子目录下增加 `xx.cc` 源文件,然后在 CO 根目录下执行 `xmake -b xx` 即可构建。 +[co/test](https://github.com/idealvin/coost/tree/master/test) 是一些测试代码,在 co/test 目录或其子目录下增加 `xx.cc` 源文件,然后在 CO 根目录下执行 `xmake -b xx` 即可构建。 ```bash xmake -b flag # 编译 test/flag.cc @@ -188,7 +188,7 @@ cp gen /usr/local/bin/ gen hello_world.proto ``` -proto 文件格式可以参考 [hello_world.proto](https://github.com/idealvin/co/blob/master/test/so/rpc/hello_world.proto)。 +proto 文件格式可以参考 [hello_world.proto](https://github.com/idealvin/coost/blob/master/test/so/rpc/hello_world.proto)。 diff --git a/content/cn/co/coroutine.md b/content/cn/co/coroutine.md index 104be40..6eb3241 100644 --- a/content/cn/co/coroutine.md +++ b/content/cn/co/coroutine.md @@ -3,7 +3,7 @@ weight: 11 title: "协程" --- -include: [co/co.h](https://github.com/idealvin/co/blob/master/include/co/co.h). +include: [co/co.h](https://github.com/idealvin/coost/blob/master/include/co/co.h). ## 基本概念 @@ -1269,7 +1269,7 @@ IoEvent(sock_t fd, int n=0); // for windows only - 构造函数,linux 与 mac 平台只提供第 1 个版本,windows 平台还提供第 2 个版本。 - 第 1 个版本中,**参数 fd 是一个 non-blocking socket**,参数 ev 是 I/O 事件类型,只能是 co::ev_read 或 co::ev_write 中的一种。调用 wait() 方法会在 socket 上等待 ev 指定的 I/O 事件,wait() 成功返回时,需要用户调用 recv, send 等函数完成 I/O 操作。**在 windows 平台,fd 必须是 TCP socket**(对于 UDP,很难用 IOCP 模拟 epoll 或 kqueue 的行为)。 -- 第 2 个版本仅适用于 windows,与第 1 个版本不同,fd 可以是 UDP socket,但用户需要手动调用 WSARecvFrom, WSASendTo 等函数向 IOCP 发送 overlapped I/O 请求,然后调用 wait() 方法,当 wait() 成功返回时,表示 IOCP 已经帮用户完成了 I/O 操作。具体的用法此处不详述,代码中有详细的注释,建议直接参考 [co::IoEvent 的源码](https://github.com/idealvin/co/blob/master/include/co/co/io_event.h),以及 windows 上 [co::accept, co::connect, co::recvfrom, co::sendto 的实现](https://github.com/idealvin/co/blob/master/src/co/sock_win.cc)。 +- 第 2 个版本仅适用于 windows,与第 1 个版本不同,fd 可以是 UDP socket,但用户需要手动调用 WSARecvFrom, WSASendTo 等函数向 IOCP 发送 overlapped I/O 请求,然后调用 wait() 方法,当 wait() 成功返回时,表示 IOCP 已经帮用户完成了 I/O 操作。具体的用法此处不详述,代码中有详细的注释,建议直接参考 [co::IoEvent 的源码](https://github.com/idealvin/coost/blob/master/include/co/co/io_event.h),以及 windows 上 [co::accept, co::connect, co::recvfrom, co::sendto 的实现](https://github.com/idealvin/coost/blob/master/src/co/sock_win.cc)。 @@ -1415,7 +1415,7 @@ go(server_fun); - 在一个协程中,调用 `co::accept()` 接受客户端连接。 - 有连接到来时,创建一个新的协程,在协程中处理连接上的数据。 - `on_connection()` 是处理连接的协程函数,接收、处理与发送数据,在该协程中以完全同步的方式进行,不需要任何异步回调。 -- 完整的实现可以参考 [co 中的测试代码](https://github.com/idealvin/co/blob/master/test/so/tcp2.cc)。 +- 完整的实现可以参考 [co 中的测试代码](https://github.com/idealvin/coost/blob/master/test/so/tcp2.cc)。 @@ -1436,7 +1436,7 @@ go(client_fun); ``` - 建立连接,发送、接收、处理数据,在协程中以完全同步的方式进行。 -- 完整的实现可以参考 [co 中的测试代码](https://github.com/idealvin/co/blob/master/test/so/tcp2.cc)。 +- 完整的实现可以参考 [co 中的测试代码](https://github.com/idealvin/coost/blob/master/test/so/tcp2.cc)。 实际应用中,一般使用 **co::Pool** 作为连接池,以避免创建过多的连接: diff --git a/content/cn/co/def.md b/content/cn/co/def.md index 9dea453..ccb5999 100644 --- a/content/cn/co/def.md +++ b/content/cn/co/def.md @@ -3,7 +3,7 @@ weight: 1 title: "基本定义" --- -include: [co/def.h](https://github.com/idealvin/co/blob/master/include/co/def.h). +include: [co/def.h](https://github.com/idealvin/coost/blob/master/include/co/def.h). ## typedefs diff --git a/content/cn/co/defer.md b/content/cn/co/defer.md index 094236a..b5ebf08 100644 --- a/content/cn/co/defer.md +++ b/content/cn/co/defer.md @@ -3,7 +3,7 @@ weight: 2 title: "defer" --- -include: [co/defer.h](https://github.com/idealvin/co/blob/master/include/co/defer.h). +include: [co/defer.h](https://github.com/idealvin/coost/blob/master/include/co/defer.h). ## defer diff --git a/content/cn/co/fastream.md b/content/cn/co/fastream.md index 09b5f42..8f71281 100644 --- a/content/cn/co/fastream.md +++ b/content/cn/co/fastream.md @@ -3,7 +3,7 @@ weight: 3 title: "字符流(fastream)" --- -include: [co/fastream.h](https://github.com/idealvin/co/blob/master/include/co/fastream.h). +include: [co/fastream.h](https://github.com/idealvin/coost/blob/master/include/co/fastream.h). ## fastream diff --git a/content/cn/co/fastring.md b/content/cn/co/fastring.md index ce82ac8..2a86624 100644 --- a/content/cn/co/fastring.md +++ b/content/cn/co/fastring.md @@ -3,7 +3,7 @@ weight: 2 title: "字符串(fastring)" --- -include: [co/fastring.h](https://github.com/idealvin/co/blob/master/include/co/fastring.h). +include: [co/fastring.h](https://github.com/idealvin/coost/blob/master/include/co/fastring.h). ## fastring diff --git a/content/cn/co/flag.md b/content/cn/co/flag.md index ae194be..793d40c 100644 --- a/content/cn/co/flag.md +++ b/content/cn/co/flag.md @@ -3,7 +3,7 @@ weight: 5 title: "命令行参数与配置文件解析" --- -include: [co/flag.h](https://github.com/idealvin/co/blob/master/include/co/flag.h). +include: [co/flag.h](https://github.com/idealvin/coost/blob/master/include/co/flag.h). ## 基本概念 diff --git a/content/cn/co/fs.md b/content/cn/co/fs.md index 4ebbb55..caa1c02 100644 --- a/content/cn/co/fs.md +++ b/content/cn/co/fs.md @@ -4,7 +4,7 @@ title: "文件系统" --- -include: [co/fs.h](https://github.com/idealvin/co/blob/master/include/co/fs.h). +include: [co/fs.h](https://github.com/idealvin/coost/blob/master/include/co/fs.h). `co/fs.h` 最小限度的实现了常用的文件系统操作,不同平台路径分隔符建议统一使用 `'/'`。 diff --git a/content/cn/co/hash.md b/content/cn/co/hash.md index 66c3d2e..a6bb923 100644 --- a/content/cn/co/hash.md +++ b/content/cn/co/hash.md @@ -4,7 +4,7 @@ title: "Hash" --- -include: [co/hash.h](https://github.com/idealvin/co/blob/master/include/co/hash.h). +include: [co/hash.h](https://github.com/idealvin/coost/blob/master/include/co/hash.h). ## Hash diff --git a/content/cn/co/json.md b/content/cn/co/json.md index 72e7bcf..cc7360c 100644 --- a/content/cn/co/json.md +++ b/content/cn/co/json.md @@ -3,7 +3,7 @@ weight: 8 title: "JSON" --- -include: [co/json.h](https://github.com/idealvin/co/blob/master/include/co/json.h). +include: [co/json.h](https://github.com/idealvin/coost/blob/master/include/co/json.h). `co/json` 是一个类似 [rapidjson](https://github.com/Tencent/rapidjson) 的 JSON 库,与 rapidjson 相比,它既有性能上的优势,同时又更简单易用。 diff --git a/content/cn/co/log.md b/content/cn/co/log.md index 7c7396a..bbc738f 100644 --- a/content/cn/co/log.md +++ b/content/cn/co/log.md @@ -3,7 +3,7 @@ weight: 6 title: "日志" --- -include: [co/log.h](https://github.com/idealvin/co/blob/master/include/co/log.h). +include: [co/log.h](https://github.com/idealvin/coost/blob/master/include/co/log.h). ## 简介 @@ -474,5 +474,5 @@ xmake r log -min_log_level=1 # 0-4: debug,info,warning,error,fatal xmake r log -perf # performance test ``` -- 在 co 根目录执行 `xmake -b log` 即可编译 [test/log.cc](https://github.com/idealvin/co/blob/master/test/log.cc) 测试代码,并生成 `log` 二进制文件。 +- 在 co 根目录执行 `xmake -b log` 即可编译 [test/log.cc](https://github.com/idealvin/coost/blob/master/test/log.cc) 测试代码,并生成 `log` 二进制文件。 diff --git a/content/cn/co/lrumap.md b/content/cn/co/lrumap.md index 41ec589..3d46b63 100644 --- a/content/cn/co/lrumap.md +++ b/content/cn/co/lrumap.md @@ -4,7 +4,7 @@ title: "LruMap" --- -include: [co/lru_map.h](https://github.com/idealvin/co/blob/master/include/co/lru_map.h). +include: [co/lru_map.h](https://github.com/idealvin/coost/blob/master/include/co/lru_map.h). ## LruMap diff --git a/content/cn/co/net/byte_order.md b/content/cn/co/net/byte_order.md index bb7846f..92a1a97 100644 --- a/content/cn/co/net/byte_order.md +++ b/content/cn/co/net/byte_order.md @@ -4,7 +4,7 @@ title: "字节序" --- -include: [co/byte_order.h](https://github.com/idealvin/co/blob/master/include/co/byte_order.h). +include: [co/byte_order.h](https://github.com/idealvin/coost/blob/master/include/co/byte_order.h). 计算机中的数据在内存中是以字节(8 bit)为基本单位进行存储的,大端机采用大端字节序,即高位字节在低地址,低位字节在高地址,小端机则采用小端字节序,即低位字节在低地址,高位字节在高地址。 diff --git a/content/cn/co/net/http.md b/content/cn/co/net/http.md index 4d08f05..638b669 100644 --- a/content/cn/co/net/http.md +++ b/content/cn/co/net/http.md @@ -4,7 +4,7 @@ title: "HTTP" --- -include: [co/http.h](https://github.com/idealvin/co/blob/master/include/co/http.h). +include: [co/http.h](https://github.com/idealvin/coost/blob/master/include/co/http.h). ## http::Client @@ -490,7 +490,7 @@ http::Server().on_req(cb).start( ); ``` -`co/test` 提供了一个简单的 [demo](https://github.com/idealvin/co/blob/master/test/so/http_serv.cc),用户可以按下述方式编译运行: +`co/test` 提供了一个简单的 [demo](https://github.com/idealvin/coost/blob/master/test/so/http_serv.cc),用户可以按下述方式编译运行: ```bash xmake -b http_serv diff --git a/content/cn/co/net/rpc.md b/content/cn/co/net/rpc.md index 402813a..b14d6c5 100644 --- a/content/cn/co/net/rpc.md +++ b/content/cn/co/net/rpc.md @@ -4,7 +4,7 @@ title: "RPC" --- -include: [co/rpc.h](https://github.com/idealvin/co/blob/master/include/co/rpc.h). +include: [co/rpc.h](https://github.com/idealvin/coost/blob/master/include/co/rpc.h). co/rpc 是一个类似 [grpc](https://github.com/grpc/grpc) 的高性能 RPC 框架,它内部使用 **JSON** 格式传输数据,而不是 protobuf 等二进制协议。从 v3.0 开始,co/rpc 同时支持 HTTP 协议,可以用 HTTP 的 POST 方法调用 rpc 服务。 @@ -114,7 +114,7 @@ service HelloWorld { ### 生成 service 代码 -[gen](https://github.com/idealvin/co/tree/master/gen) 是 co 提供的 RPC 代码生成器,它可以生成 service 相关代码。 +[gen](https://github.com/idealvin/coost/tree/master/gen) 是 co 提供的 RPC 代码生成器,它可以生成 service 相关代码。 ```bash xmake -b gen # 构建 gen diff --git a/content/cn/co/net/tcp.md b/content/cn/co/net/tcp.md index aa43d3d..8e9fcda 100644 --- a/content/cn/co/net/tcp.md +++ b/content/cn/co/net/tcp.md @@ -4,7 +4,7 @@ title: "TCP" --- -include: [co/tcp.h](https://github.com/idealvin/co/blob/master/include/co/tcp.h). +include: [co/tcp.h](https://github.com/idealvin/coost/blob/master/include/co/tcp.h). ## tcp::Connection diff --git a/content/cn/co/os.md b/content/cn/co/os.md index 44ac0de..f4acedc 100644 --- a/content/cn/co/os.md +++ b/content/cn/co/os.md @@ -4,7 +4,7 @@ title: "操作系统" --- -include: [co/os.h](https://github.com/idealvin/co/blob/master/include/co/os.h). +include: [co/os.h](https://github.com/idealvin/coost/blob/master/include/co/os.h). ## os diff --git a/content/cn/co/path.md b/content/cn/co/path.md index ebcdf18..7825c78 100644 --- a/content/cn/co/path.md +++ b/content/cn/co/path.md @@ -4,7 +4,7 @@ title: "文件路径(path)" --- -include: [co/path.h](https://github.com/idealvin/co/blob/master/include/co/path.h). +include: [co/path.h](https://github.com/idealvin/coost/blob/master/include/co/path.h). ## path diff --git a/content/cn/co/random.md b/content/cn/co/random.md index dd5e332..b57bf95 100644 --- a/content/cn/co/random.md +++ b/content/cn/co/random.md @@ -3,7 +3,7 @@ weight: 18 title: "随机数" --- -include: [co/random.h](https://github.com/idealvin/co/blob/master/include/co/random.h). +include: [co/random.h](https://github.com/idealvin/coost/blob/master/include/co/random.h). ## Random diff --git a/content/cn/co/str.md b/content/cn/co/str.md index 197a33f..5fe1b84 100644 --- a/content/cn/co/str.md +++ b/content/cn/co/str.md @@ -3,7 +3,7 @@ weight: 4 title: "字符串操作" --- -include: [co/str.h](https://github.com/idealvin/co/tree/master/include/co/str.h). +include: [co/str.h](https://github.com/idealvin/coost/tree/master/include/co/str.h). ## 切分、修剪、替换、连接 diff --git a/content/cn/co/tasked.md b/content/cn/co/tasked.md index f0fc036..4729f36 100644 --- a/content/cn/co/tasked.md +++ b/content/cn/co/tasked.md @@ -4,7 +4,7 @@ title: "定时任务" --- -include: [co/tasked.h](https://github.com/idealvin/co/blob/master/include/co/tasked.h). +include: [co/tasked.h](https://github.com/idealvin/coost/blob/master/include/co/tasked.h). ## Tasked diff --git a/content/cn/co/thread.md b/content/cn/co/thread.md index a7577b2..7671491 100644 --- a/content/cn/co/thread.md +++ b/content/cn/co/thread.md @@ -3,7 +3,7 @@ weight: 10 title: "线程" --- -include: [co/thread.h](https://github.com/idealvin/co/blob/master/include/co/thread.h). +include: [co/thread.h](https://github.com/idealvin/coost/blob/master/include/co/thread.h). ## 线程(Thread) diff --git a/content/cn/co/time.md b/content/cn/co/time.md index ffd6ba6..ef7cb72 100644 --- a/content/cn/co/time.md +++ b/content/cn/co/time.md @@ -3,7 +3,7 @@ weight: 9 title: "时间" --- -include: [co/time.h](https://github.com/idealvin/co/blob/master/include/co/time.h). +include: [co/time.h](https://github.com/idealvin/coost/blob/master/include/co/time.h). ## epoch time diff --git a/content/cn/co/unitest.md b/content/cn/co/unitest.md index 39c627d..6871ab9 100644 --- a/content/cn/co/unitest.md +++ b/content/cn/co/unitest.md @@ -3,7 +3,7 @@ weight: 7 title: "单元测试框架" --- -include: [co/unitest.h](https://github.com/idealvin/co/blob/master/include/co/unitest.h). +include: [co/unitest.h](https://github.com/idealvin/coost/blob/master/include/co/unitest.h). ## 基本概念 @@ -177,7 +177,7 @@ int main(int argc, char** argv) { xmake -b unitest ``` -- 在 co 根目录执行上述命令,即可编译 [co/unitest](https://github.com/idealvin/co/tree/master/unitest) 目录下的单元测试代码,并生成 `unitest` 二进制程序。 +- 在 co 根目录执行上述命令,即可编译 [co/unitest](https://github.com/idealvin/coost/tree/master/unitest) 目录下的单元测试代码,并生成 `unitest` 二进制程序。 diff --git a/content/en/co/atomic.md b/content/en/co/atomic.md index 4fbd658..fcd7752 100644 --- a/content/en/co/atomic.md +++ b/content/en/co/atomic.md @@ -3,7 +3,7 @@ weight: 2 title: "Atomic Operations" --- -include: [co/atomic.h](https://github.com/idealvin/co/tree/master/include/co/atomic.h). +include: [co/atomic.h](https://github.com/idealvin/coost/tree/master/include/co/atomic.h). ## Memory Order @@ -442,9 +442,9 @@ template inline T atomic_xor(T* p, V v, memory_order_t mo = mo_seq_cst); ``` -- Atomic bitwise XOR operation, T is any integer type with a length of 1, 2, 4, 8 bytes, V is any integer type, and the parameter p is a pointer of type T. +- Atomic bitwise `XOR` operation, T is any integer type with a length of 1, 2, 4, 8 bytes, V is any integer type, and the parameter p is a pointer of type T. -- This function performs a bitwise XOR operation on the integer pointed to by p and v, and returns the result of the operation. +- This function performs a bitwise `XOR` operation on the integer pointed to by p and v, and returns the result of the operation. - Example @@ -465,7 +465,7 @@ template inline T atomic_fetch_xor(T* p, V v, memory_order_t mo = mo_seq_cst); ``` -- The same as [atomic_xor](#atomic_xor), but returns the value before the bitwise XOR operation. +- The same as [atomic_xor](#atomic_xor), but returns the value before the bitwise `XOR` operation. - Example diff --git a/content/en/co/build.md b/content/en/co/build.md index eb4bfe8..15f1242 100644 --- a/content/en/co/build.md +++ b/content/en/co/build.md @@ -111,7 +111,7 @@ xmake -v #### Android and IOS support -CO can also be built on Android and IOS platforms, see [Github Actions](https://github.com/idealvin/co/actions) for details. Since the author has no front-end development experience, it has not been tested on Android and IOS. +CO can also be built on Android and IOS platforms, see [Github Actions](https://github.com/idealvin/coost/actions) for details. Since the author has no front-end development experience, it has not been tested on Android and IOS. - android @@ -131,7 +131,7 @@ xmake -v ### Build and run unitest code -[co/unitest](https://github.com/idealvin/co/tree/master/unitest) contains some unit test code, run the following commands to build and run the test program: +[co/unitest](https://github.com/idealvin/coost/tree/master/unitest) contains some unit test code, run the following commands to build and run the test program: ```bash xmake -b unitest # build unitest @@ -144,7 +144,7 @@ xmake r unitest -json # run unit test: json ### Build and run test code -[co/test](https://github.com/idealvin/co/tree/master/test) contains some test code, add `xx.cc` source file in the co/test directory or its subdirectories, and then run `xmake -b xx` in the root directory of CO to build it. +[co/test](https://github.com/idealvin/coost/tree/master/test) contains some test code, add `xx.cc` source file in the co/test directory or its subdirectories, and then run `xmake -b xx` in the root directory of CO to build it. ```bash xmake -b flag # compile test/flag.cc @@ -171,7 +171,7 @@ cp gen /usr/local/bin/ gen hello_world.proto ``` -The proto file format can refer to [hello_world.proto](https://github.com/idealvin/co/blob/master/test/so/rpc/hello_world.proto). +The proto file format can refer to [hello_world.proto](https://github.com/idealvin/coost/blob/master/test/so/rpc/hello_world.proto). diff --git a/content/en/co/coroutine.md b/content/en/co/coroutine.md index b8704c5..1f756f8 100644 --- a/content/en/co/coroutine.md +++ b/content/en/co/coroutine.md @@ -3,7 +3,7 @@ weight: 11 title: "Coroutine" --- -include: [co/co.h](https://github.com/idealvin/co/blob/master/include/co/co.h). +include: [co/co.h](https://github.com/idealvin/coost/blob/master/include/co/co.h). ## Basic concepts @@ -1259,7 +1259,7 @@ IoEvent(sock_t fd, int n=0); // for windows only - Constructor, linux and mac platforms only provide the first version, windows platform also provides the second version. - In the first version, the **parameter fd is a non-blocking socket**, and the parameter ev is an I/O event, which is one of co::ev_read or co::ev_write. Calling the wait() method will wait for the I/O event specified by ev on the socket. When wait() returns successfully, users need to call recv, send or other I/O functions to complete the I/O operation. **On windows, fd must be a TCP socket**(For UDP, it is difficult to simulate the behavior of epoll or kqueue with IOCP). -- The second version is only applicable to windows. Unlike the first version, fd can be a UDP socket, but users must manually call WSARecvFrom, WSASendTo or other functions to post an overlapped I/O operation to IOCP, and then call the wait() method. When wait() returns successfully, it means that IOCP has completed the I/O operation. See details in source code of [co::IoEvent](https://github.com/idealvin/co/blob/master/include/co/co/io_event.h), and implementation of [co::accept, co::connect, co::recvfrom, co::sendto](https://github.com/idealvin/co/blob/master/src/co/sock_win.cc) on windows. +- The second version is only applicable to windows. Unlike the first version, fd can be a UDP socket, but users must manually call WSARecvFrom, WSASendTo or other functions to post an overlapped I/O operation to IOCP, and then call the wait() method. When wait() returns successfully, it means that IOCP has completed the I/O operation. See details in source code of [co::IoEvent](https://github.com/idealvin/coost/blob/master/include/co/co/io_event.h), and implementation of [co::accept, co::connect, co::recvfrom, co::sendto](https://github.com/idealvin/coost/blob/master/src/co/sock_win.cc) on windows. @@ -1403,7 +1403,7 @@ go(server_fun); - In one coroutine, call `co::accept()` to accept client connections. - When a connection is accepted, create a new coroutine to handle the connection. - `on_connection()` is the coroutine function for handling connections, receiving, processing and sending data are performed in a synchronous manner in the coroutine, and we do not need any asynchronous callback. -- For complete implementation, please refer to [Test code in CO](https://github.com/idealvin/co/blob/master/test/so/tcp2.cc). +- For complete implementation, please refer to [Test code in CO](https://github.com/idealvin/coost/blob/master/test/so/tcp2.cc). @@ -1425,7 +1425,7 @@ go(client_fun); - Connecting, sending, recving and processing data are performed in a synchronous manner in the coroutine. -- For complete implementation, please refer to [Test code in CO](https://github.com/idealvin/co/blob/master/test/so/tcp2.cc). +- For complete implementation, please refer to [Test code in CO](https://github.com/idealvin/coost/blob/master/test/so/tcp2.cc). In actual applications, **co::Pool** is generally used as a connection pool to avoid creating too many connections: diff --git a/content/en/co/def.md b/content/en/co/def.md index 0214e2e..4842e66 100644 --- a/content/en/co/def.md +++ b/content/en/co/def.md @@ -3,7 +3,7 @@ weight: 1 title: "Basic definitions" --- -include: [co/def.h](https://github.com/idealvin/co/blob/master/include/co/def.h). +include: [co/def.h](https://github.com/idealvin/coost/blob/master/include/co/def.h). ## typedefs diff --git a/content/en/co/defer.md b/content/en/co/defer.md index 6f60f5b..9077c10 100644 --- a/content/en/co/defer.md +++ b/content/en/co/defer.md @@ -3,7 +3,7 @@ weight: 1 title: "defer" --- -include: [co/defer.h](https://github.com/idealvin/co/blob/master/include/co/defer.h). +include: [co/defer.h](https://github.com/idealvin/coost/blob/master/include/co/defer.h). ## defer diff --git a/content/en/co/fastream.md b/content/en/co/fastream.md index 8dce33f..5867cea 100644 --- a/content/en/co/fastream.md +++ b/content/en/co/fastream.md @@ -3,7 +3,7 @@ weight: 3 title: "fastream" --- -include: [co/fastream.h](https://github.com/idealvin/co/blob/master/include/co/fastream.h). +include: [co/fastream.h](https://github.com/idealvin/coost/blob/master/include/co/fastream.h). ## fastream diff --git a/content/en/co/fastring.md b/content/en/co/fastring.md index 6f16e07..3c68461 100644 --- a/content/en/co/fastring.md +++ b/content/en/co/fastring.md @@ -3,7 +3,7 @@ weight: 2 title: "fastring" --- -include: [co/fastring.h](https://github.com/idealvin/co/blob/master/include/co/fastring.h). +include: [co/fastring.h](https://github.com/idealvin/coost/blob/master/include/co/fastring.h). ## fastring diff --git a/content/en/co/flag.md b/content/en/co/flag.md index 4b882e7..4679dc5 100644 --- a/content/en/co/flag.md +++ b/content/en/co/flag.md @@ -3,7 +3,7 @@ weight: 5 title: "co/flag" --- -include: [co/flag.h](https://github.com/idealvin/co/blob/master/include/co/flag.h). +include: [co/flag.h](https://github.com/idealvin/coost/blob/master/include/co/flag.h). ## Basic concepts diff --git a/content/en/co/fs.md b/content/en/co/fs.md index d5a9e7a..59a5764 100644 --- a/content/en/co/fs.md +++ b/content/en/co/fs.md @@ -3,7 +3,7 @@ weight: 22 title: "File System" --- -include: [co/fs.h](https://github.com/idealvin/co/blob/master/include/co/fs.h). +include: [co/fs.h](https://github.com/idealvin/coost/blob/master/include/co/fs.h). diff --git a/content/en/co/hash.md b/content/en/co/hash.md index 83e7640..3b0adfe 100644 --- a/content/en/co/hash.md +++ b/content/en/co/hash.md @@ -3,7 +3,7 @@ weight: 20 title: "Hash" --- -include: [co/hash.h](https://github.com/idealvin/co/blob/master/include/co/hash.h). +include: [co/hash.h](https://github.com/idealvin/coost/blob/master/include/co/hash.h). ## Hash diff --git a/content/en/co/json.md b/content/en/co/json.md index fb90c5d..4ffd6e6 100644 --- a/content/en/co/json.md +++ b/content/en/co/json.md @@ -3,7 +3,7 @@ weight: 8 title: "JSON" --- -include: [co/json.h](https://github.com/idealvin/co/blob/master/include/co/json.h). +include: [co/json.h](https://github.com/idealvin/coost/blob/master/include/co/json.h). `co/json` is a JSON library similar to [rapidjson](https://github.com/Tencent/rapidjson). Compared with rapidjson, it has better performance and is easier to use. diff --git a/content/en/co/log.md b/content/en/co/log.md index 38b9b7b..b9e79c8 100644 --- a/content/en/co/log.md +++ b/content/en/co/log.md @@ -3,7 +3,7 @@ weight: 6 title: "co/log" --- -include: [co/log.h](https://github.com/idealvin/co/blob/master/include/co/log.h). +include: [co/log.h](https://github.com/idealvin/coost/blob/master/include/co/log.h). ## Introduction @@ -477,4 +477,4 @@ xmake r log -min_log_level=1 # 0-4: debug,info,warning,error,fatal xmake r log -perf # performance test ``` -- Run `xmake -b log` in the co root directory to compile [test/log.cc](https://github.com/idealvin/co/blob/master/test/log.cc), and a binary program named log or log.exe will be generated. +- Run `xmake -b log` in the co root directory to compile [test/log.cc](https://github.com/idealvin/coost/blob/master/test/log.cc), and a binary program named log or log.exe will be generated. diff --git a/content/en/co/lrumap.md b/content/en/co/lrumap.md index 8f75f62..5a8166a 100644 --- a/content/en/co/lrumap.md +++ b/content/en/co/lrumap.md @@ -3,7 +3,7 @@ weight: 19 title: "LruMap" --- -include: [co/lru_map.h](https://github.com/idealvin/co/blob/master/include/co/lru_map.h). +include: [co/lru_map.h](https://github.com/idealvin/coost/blob/master/include/co/lru_map.h). ## LruMap diff --git a/content/en/co/net/byte_order.md b/content/en/co/net/byte_order.md index 1c500d9..7263929 100644 --- a/content/en/co/net/byte_order.md +++ b/content/en/co/net/byte_order.md @@ -3,7 +3,7 @@ weight: 13 title: "Byte order" --- -include: [co/byte_order.h](https://github.com/idealvin/co/blob/master/include/co/byte_order.h). +include: [co/byte_order.h](https://github.com/idealvin/coost/blob/master/include/co/byte_order.h). diff --git a/content/en/co/net/http.md b/content/en/co/net/http.md index e9fc01c..60c2212 100644 --- a/content/en/co/net/http.md +++ b/content/en/co/net/http.md @@ -3,7 +3,7 @@ weight: 15 title: "HTTP" --- -include: [co/http.h](https://github.com/idealvin/co/blob/master/include/co/http.h). +include: [co/http.h](https://github.com/idealvin/coost/blob/master/include/co/http.h). ## http::Client diff --git a/content/en/co/net/rpc.md b/content/en/co/net/rpc.md index 6dd3037..b2982b4 100644 --- a/content/en/co/net/rpc.md +++ b/content/en/co/net/rpc.md @@ -4,7 +4,7 @@ title: "RPC" --- -include: [co/rpc.h](https://github.com/idealvin/co/blob/master/include/co/rpc.h). +include: [co/rpc.h](https://github.com/idealvin/coost/blob/master/include/co/rpc.h). co/rpc is a high-performance RPC framework similar to [grpc](https://github.com/grpc/grpc), it uses **JSON** as the data exchange format, which is different from binary protocols such as protobuf. @@ -113,7 +113,7 @@ service HelloWorld { ### Generate code for RPC service -[gen](https://github.com/idealvin/co/tree/master/gen) is the RPC code generator provided by co, which can be used to generate code for RPC service. +[gen](https://github.com/idealvin/coost/tree/master/gen) is the RPC code generator provided by co, which can be used to generate code for RPC service. ```bash xmake -b gen # build gen diff --git a/content/en/co/net/tcp.md b/content/en/co/net/tcp.md index d966d94..2b2fcb3 100644 --- a/content/en/co/net/tcp.md +++ b/content/en/co/net/tcp.md @@ -3,7 +3,7 @@ weight: 14 title: "TCP" --- -include: [co/tcp.h](https://github.com/idealvin/co/blob/master/include/co/tcp.h). +include: [co/tcp.h](https://github.com/idealvin/coost/blob/master/include/co/tcp.h). ## tcp::Connection diff --git a/content/en/co/os.md b/content/en/co/os.md index fe9295e..46d08a2 100644 --- a/content/en/co/os.md +++ b/content/en/co/os.md @@ -3,7 +3,7 @@ weight: 23 title: "Operating System" --- -include: [co/os.h](https://github.com/idealvin/co/blob/master/include/co/os.h). +include: [co/os.h](https://github.com/idealvin/coost/blob/master/include/co/os.h). ## os diff --git a/content/en/co/path.md b/content/en/co/path.md index 5bd282d..b5e15c1 100644 --- a/content/en/co/path.md +++ b/content/en/co/path.md @@ -3,7 +3,7 @@ weight: 21 title: "Path" --- -include: [co/path.h](https://github.com/idealvin/co/blob/master/include/co/path.h). +include: [co/path.h](https://github.com/idealvin/coost/blob/master/include/co/path.h). ## path diff --git a/content/en/co/random.md b/content/en/co/random.md index eef4c9c..eb14a28 100644 --- a/content/en/co/random.md +++ b/content/en/co/random.md @@ -3,7 +3,7 @@ weight: 18 title: "Random number" --- -include: [co/random.h](https://github.com/idealvin/co/blob/master/include/co/random.h). +include: [co/random.h](https://github.com/idealvin/coost/blob/master/include/co/random.h). ## Random diff --git a/content/en/co/str.md b/content/en/co/str.md index 881f292..bb0a520 100644 --- a/content/en/co/str.md +++ b/content/en/co/str.md @@ -3,7 +3,7 @@ weight: 4 title: "String utilities" --- -include: [co/str.h](https://github.com/idealvin/co/tree/master/include/co/str.h). +include: [co/str.h](https://github.com/idealvin/coost/tree/master/include/co/str.h). ## split, strip, replace, diff --git a/content/en/co/tasked.md b/content/en/co/tasked.md index c4f4be6..165bd36 100644 --- a/content/en/co/tasked.md +++ b/content/en/co/tasked.md @@ -4,7 +4,7 @@ title: "Timed task scheduler" --- -include: [co/tasked.h](https://github.com/idealvin/co/blob/master/include/co/tasked.h). +include: [co/tasked.h](https://github.com/idealvin/coost/blob/master/include/co/tasked.h). ## Tasked diff --git a/content/en/co/thread.md b/content/en/co/thread.md index 2179c90..937cf30 100644 --- a/content/en/co/thread.md +++ b/content/en/co/thread.md @@ -3,7 +3,7 @@ weight: 10 title: "Thread" --- -include: [co/thread.h](https://github.com/idealvin/co/blob/master/include/co/thread.h). +include: [co/thread.h](https://github.com/idealvin/coost/blob/master/include/co/thread.h). ## Thread diff --git a/content/en/co/time.md b/content/en/co/time.md index f1d9008..05eec0e 100644 --- a/content/en/co/time.md +++ b/content/en/co/time.md @@ -3,7 +3,7 @@ weight: 9 title: "Time" --- -include: [co/time.h](https://github.com/idealvin/co/blob/master/include/co/time.h). +include: [co/time.h](https://github.com/idealvin/coost/blob/master/include/co/time.h). ## epoch time diff --git a/content/en/co/unitest.md b/content/en/co/unitest.md index 15f2b13..6fcab3a 100644 --- a/content/en/co/unitest.md +++ b/content/en/co/unitest.md @@ -3,7 +3,7 @@ weight: 7 title: "Unitest" --- -include: [co/unitest.h](https://github.com/idealvin/co/blob/master/include/co/unitest.h). +include: [co/unitest.h](https://github.com/idealvin/coost/blob/master/include/co/unitest.h). ## Basic concepts @@ -196,7 +196,7 @@ xmake -b unitest ``` -- Execute the above command in the co root directory to compile the unit test code in the [co/unitest](https://github.com/idealvin/co/tree/master/unitest) directory and generate the `unitest` binary program . +- Execute the above command in the co root directory to compile the unit test code in the [co/unitest](https://github.com/idealvin/coost/tree/master/unitest) directory and generate the `unitest` binary program .