News for hackers. Stuff that matters.
Re:Rust solves the problem of incomplete Kernel Linux API docs by metaltyphoon on Saturday August 31, 2024 @12:40PM (#41410009)
Isn’t anything with Arc thread safe?
Re:Rust solves the problem of incomplete Kernel Linux API docs by ninkendo on Saturday August 31, 2024 @01:09PM (#41410245)
No. Just because something’s behind an Arc<T> doesn’t mean two threads can hold it at once. Arc just ensures that it is freed (dropped) when no threads are using it any more. T itself has to be Send+Sync for Arc to be.

To a first approximation, Arc<Mutex<T>> is what you want when you want a blob of mutable stuff to just work between threads, but you still have to worry about terrible performance if you hold the mutexes too long, etc. (Not to mention mutexes are just slower in general than having types which are natively Send+Sync.)

Re:Rust solves the problem of incomplete Kernel Linux API docs by jpc0 on Saturday August 31, 2024 @03:04PM (#41411066)
> Not to mention mutexes are just slower in general than having types which are natively Send+Sync

Without knowing the implementation, how would you know this statement is true?

I could just stick the Arc<Mutex<T>> within my abstraction and say it is send+sync and it would have the exact same performance, and that might be the most efficient solution possible on the given hardware.

Re:Rust solves the problem of incomplete Kernel Linux API docs by ab5tract on Saturday August 31, 2024 @12:41PM (#41410025)
Telling when a thing is thread safe is hardly the same as telling when something isn’t.