-
Notifications
You must be signed in to change notification settings - Fork 779
Open
Description
我在AsyncWrite_加入了 cout 语句,发现没运行几次,就会有一次卡在这个函数里面,卡在 join 里面,进程不能结束。
发现:这个函数一直进行循环,只有当pop 的值返回为 false 时进行停止。

正常情况下,当执行 deque close的时候,会唤醒 consumer,此时 isClose_为 true,pop 返回 false,线程结束。
但是存在一种情况,唤醒 consumer 的时候,此时 consumer 并未被阻塞。当执行完notify之后,consumer 才 wait,这时候就会触发这个 bug。
解决方法 在BlockDeque中的pop 循环条件添加判断 isClosed 或者在Log 中加入判断是否终止的代码
Metadata
Metadata
Assignees
Labels
No labels