3 ms·
On the whole the compiler detects when things are 'Send' & 'Sync'. If you write your program thread-safe, you won't have issues. And that's the crux of the mat
by cmrdporcupine 3y ago
On the whole the compiler detects when things are 'Send' & 'Sync'. If you write your program thread-safe, you won't have issues.
And that's the crux of the matter: people are griping on the whole because maybe Tokio async is hard when it puts Send&Sync demands all over the placer, but the reality is that writing safe concurrent code of any kind is hard. It's not intuitive, and the problem is that async makes them feel like it's happening automagically and just "taking care of it" -- but it's really not. You need to know what you're doing, and the compiler is just helping you here.
Yes, you can hide that by going thread-per-core and that could eliminate the need for Send in some circumstances (not all). But it might come back to bite you, architecturally, in the long run.