We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
在class SkipList 中的 insert_element 和 delete_element中,开头的一行使用 mtx.lock(); 尝试给数据结构上了锁,不过作为查找的 search_element 却没有上锁。这么做有个问题,虽然它避免了写-写数据竞争,但是没有避免读-写数据竞争,我并不确定在多线程环境下这样依然是安全的,例如某一线程在free的的时候另一线程仍然在读以及使用指针。
SkipList
insert_element
delete_element
mtx.lock();
search_element
The text was updated successfully, but these errors were encountered:
hxd,会不会是这样的呢,我读的时候并不在意正在写的数据呢,也就是即时的。比如一个线程在写kv,但是他没有写进去,那么我读的时候默认就是不读这个数据呢,只是个人意见,本人实力很low,不对的还望指正
Sorry, something went wrong.
要么读写都不加,要么加rw lock,只在写方法加锁无法保证线程安全。
No branches or pull requests
在class
SkipList
中的insert_element
和delete_element
中,开头的一行使用mtx.lock();
尝试给数据结构上了锁,不过作为查找的search_element
却没有上锁。这么做有个问题,虽然它避免了写-写数据竞争,但是没有避免读-写数据竞争,我并不确定在多线程环境下这样依然是安全的,例如某一线程在free的的时候另一线程仍然在读以及使用指针。The text was updated successfully, but these errors were encountered: