3 ms·
Thread safety has not usually been a concern because it’s pretty rare to use raw threads in C++. Rust folks always seem to assume people write C++ like it is 1
by fooker 9mo ago
Thread safety has not usually been a concern because it’s pretty rare to use raw threads in C++.
Rust folks always seem to assume people write C++ like it is 1995.
> implied by you questioning whether it bought any meaningful performance
This is the first thing you should always ask when you do anything with parallelism! Are you familiar with Amdahl’s law?
- vlovich123 9mo agoWhether you use raw threads or not in no way changes that thread safety is completely independent of that; eg a work stealing queue of a fixed thread pool still can have issues. And high performance code often needs you to implement certain constructs which means someone has to implement them and be sure they’re safe. Also I’ve worked on a lot of different codebases, from iOS at Apple to Android at Meta, from machine learning to VR video streaming. Claiming that people aren’t using raw threads in C++ a) isn’t borne out by the evidence b) is ignoring the challenges of writing thread safe code that has nothing to do with manually creating a thread. Hell, my team hit a libc++ bug in std::conditional_var.
- fooker 9mo agoIOS and related codebases at Apple are not using raw threads unless unavoidable.
- LexiMax 9mo ago> Thread safety has not usually been a concern because it’s pretty rare to use raw threads in C++. Rust folks always seem to assume people write C++ like it is 1995. What kind of charmed life do you lead to where use of reliable abstractions over threads is common in C++ codebases you touch? My experience has been the exact opposite.
- fooker 9mo ago> My experience has been the exact opposite Okay, can you try and find a relatively modern large open source C++ codebase that actively uses raw threads?