Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如果push和pop同时发生,这个实现是不安全的。 #1

Open
fanjing-whu opened this issue Mar 9, 2021 · 1 comment
Open

Comments

@fanjing-whu
Copy link

push1start
这里top = 0
pop1start
这里top = -1
push2start
这里top = 0
push1modify 这里修改的是top = 0
push1end
push2modify 这里修改的也是top = 0
push2end
pop1read 这里读取到的数据是push2写入的错误数据(也可能是其他情况,总之是不安全的数据)

@fanjing-whu
Copy link
Author

栈的实现

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant