MalikHou commented on code in PR #3232:
URL: https://github.com/apache/brpc/pull/3232#discussion_r2869499966


##########
docs/cn/bthread_active_task.md:
##########
@@ -0,0 +1,322 @@
+# bthread Active Task(实验性/UNSTABLE)
+
+本文介绍当前 brpc 中新增的 **Active Task** 基础设施,以及在服务端请求处理中配合 `butex` 实现:
+
+- 请求处理 bthread 挂起等待(例如等待 io_uring completion)
+- 在 bthread worker 的 active-task hook 中收割 completion
+- 在 hook 内把 waiter 恢复到当前 worker 的 **local runqueue**(不走 `_remote_rq`)
+
+本文描述的是 **当前实现** 的使用方式与边界,接口位于 `bthread/unstable.h`,属于 UNSTABLE API。
+
+## 适用场景
+
+典型场景是“每个 bthread worker 一个本地 reactor”(例如每 worker 一个 io_uring ring):
+
+1. worker 初始化时创建本地 reactor/ring。
+2. 提交异步 IO 后,在私有 `butex` 上通过 `bthread_butex_wait_local` 挂起。
+4. worker 的 active-task hook 收割 completion。
+5. hook 内调用 `bthread_butex_wake_within(ctx, req->butex)` 唤醒 waiter。
+6. waiter bthread 在同一个 worker 上恢复执行(不会被 steal)。

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to