Skip to content

bug 描述 #2

Description

@sunmp

经过分析测试你的代码q3_new.h,会有bug。
1、代码中第66行 if ((head - tail) > mask) 需要修改为 if ((uint32_t)(head - tail) > mask) ,否则发生反转的时候,队列满了,但忍让能够入队,最终导致数据丢失。
2、代码中96行,判空的地方,只需要head==tail的情况即为队列空,不过 || 后面的条件永远都无法触发,倒也不会产生bug。

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions