Comment

Comment by nyanpasu64

In my experience the average C++ programmer (not concurrency expert) writing multithreaded code does not know how to properly use mutexes and atomics to guard against shared access. Sometimes they don't know they need mutexes (https://github.com/martinrotter/rssguard/issues/362), or lock the wrong mutex (https://github.com/dolphin-emu/dolphin/pull/10540), or only lock on writes but not reads, or the set of possible states is a confusing muddled mess that neither the author nor readers understand (https://github.com/thestk/rtaudio/issues/337#issuecomment-99...). Rust's &/&mut system and mutexes are a forcing function that naturally results in cleaner code (cpal's ALSA code (https://github.com/RustAudio/cpal/blob/master/src/host/alsa/...) is beautiful and statically marks state as thread-local or shared, RtAudio's code is an entangled mess with data races).
parent nyanpasu64 4 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton