Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Is it possible to do RCU in Rust? Without unsafe blocks?


I don't know all of the subtleties, but it sounds like https://doc.rust-lang.org/stable/std/sync/struct.RwLock.html to me? At least in some way?


@steveklabnik, RCU is different from RwLock in that the single writer and all readers never block each other.

Given that RCU is a complex wait-free data structure (though I don't fully understand it), I suspect it may not necessarily be possible to implement it without unsafe blocks, purely in terms of the standard library concurrency types (atomics and Arc can be used without unsafe, but themselves contain unsafe blocks). The general goal is to create an abstraction which encapsulates unsafe blocks such that it's impossible for outside users calling safe functions to violate memory safety. Of course, libraries sometimes have bugs that need to be fixed.


Ah yeah, makes sense. I would also imagine it needs unsafe, yeah.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: