Skip to content

Commit

Permalink
Modify comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhengshuxin committed Mar 30, 2024
1 parent 8a2ec84 commit c47609a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 19 deletions.
7 changes: 4 additions & 3 deletions lib_acl_cpp/include/acl_cpp/stream/stream.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,10 @@ class ACL_CPP_API stream : public noncopyable {
int get_rw_timeout(void) const;

/**
* 注册读写流对象,内部会自动调用 hook->open 过程,如果成功,则返回之前
* 注册的对象 (可能为NULL),若失败则返回与输入参数相同的指针,应用可以
* 通过判断返回值与输入值是否相同来判断注册流对象是否成功
* 注册读写流对象,内部会自动调用 hook->open 过程,如果成功,则返回NULL
* 表明该注册的对象已经与stream绑定,将会在stream释放时解绑并被释放;
* 若失败则返回与输入参数相同的指针,应用可以通过判断返回值与输入值是否
* 相同来判断注册流对象是否成功,且在失败时返回的注册对象应由调用者释放.
* xxx: 在调用此方法前必须保证流连接已经创建
* @param hook {stream_hook*} 非空对象指针
* @return {stream_hook*} 返回值与输入值不同则表示成功
Expand Down
20 changes: 4 additions & 16 deletions lib_fiber/c/src/fiber_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -500,26 +500,18 @@ int fiber_wait_read(FILE_EVENT *fe)

if (acl_fiber_canceled(curr)) {
// If the IO has been canceled, we should try to remove the
// IO read event, because the wakeup process wasn't from
// read_callback normally.
#if 1
// Don't call event_del_read here, because it's a buffered
// delete read operation; We'll real delete read operation on
// the fd in event_close.
// IO read event directly(without delay deleting), because the
// fiber's wakeup process wasn't from read_callback normally.
event_del_read(__thread_fiber->event, fe, 1);
#endif
acl_fiber_set_error(curr->errnum);
return -1;
} else if (curr->flag & FIBER_F_TIMER) {
// If the IO reading timeout set in setsockopt.
// Clear FIBER_F_TIMER flag been set in wakeup_timers.
curr->flag &= ~FIBER_F_TIMER;
#if 1
// Don't call event_del_read here, because it's a buffered
// delete read operation; We'll real delete read operation on
// the fd in event_close.
// Delete the IO read event directly, don't buffer the delete
// status.
event_del_read(__thread_fiber->event, fe, 1);
#endif

acl_fiber_set_errno(curr, FIBER_EAGAIN);
acl_fiber_set_error(FIBER_EAGAIN);
Expand Down Expand Up @@ -585,16 +577,12 @@ int fiber_wait_write(FILE_EVENT *fe)
}

if (acl_fiber_canceled(curr)) {
#if 1
event_del_write(__thread_fiber->event, fe, 1);
#endif
acl_fiber_set_error(curr->errnum);
return -1;
} else if (curr->flag & FIBER_F_TIMER) {
curr->flag &= ~FIBER_F_TIMER;
#if 1
event_del_write(__thread_fiber->event, fe, 1);
#endif

acl_fiber_set_errno(curr, FIBER_EAGAIN);
acl_fiber_set_error(FIBER_EAGAIN);
Expand Down

0 comments on commit c47609a

Please sign in to comment.