4 ms·
Mostly I ran into a lot of friction with shared data structures that are being accessed by multiple threads. Stuff like ring buffers, flow state databases, and
by jandrese 9y ago
Mostly I ran into a lot of friction with shared data structures that are being accessed by multiple threads. Stuff like ring buffers, flow state databases, and similar systems.
There's probably Rust ways to do that stuff, but it was not obvious to me.
- littlestymaar 9y agoIf you're able to write a robust shared ring buffer in C, you should be able to do the exact same implementation in unsafe Rust using raw pointers, declare it as Sync and use it from safe Rust with no issue. Or am I missing something ? Or, if you're like me and not confident enough to do this, you could check on crates.io[1] to see if no available lib already does what you need. In which case you basically have it for free. [1] https://crates.io/keywords/ring-buffer https://crates.io/keywords/ring-buffer
- gcp 9y agoI'm pretty sure that's intentional friction (having to prove what you're doing is safe).
- jandrese 9y agoFiguring out how to prove it is safe to the compiler is definitely a challenge.