Post B6VVFaWme4IfJjxR7A by valorzard@mastodon.gamedev.place
 (DIR) More posts by valorzard@mastodon.gamedev.place
 (DIR) Post #B6VVFaHBa3p6XMeyno by luna@lunar.place
       0 likes, 0 repeats
       
       the fuck you mean i can't borrow data in an Arc as mutable
       
 (DIR) Post #B6VVFaWme4IfJjxR7A by valorzard@mastodon.gamedev.place
       0 likes, 0 repeats
       
       @luna yep you need a mutex Arc<Mutex<T>> pattern my beloathed
       
 (DIR) Post #B6VVFagi3AEvoWbMaO by luna@lunar.place
       0 likes, 0 repeats
       
       @valorzard@mastodon.gamedev.place Yea tyea, i forgot
       
 (DIR) Post #B6VVFaorYqlIDoPsIK by alina@girldick.gay
       0 likes, 0 repeats
       
       @luna @valorzard for simple types like a bool or i32 there are also atomic types in std::sync::atomic which allow concurrency safe mutations without a lock (kinda feels like doing ACID transactions but with the memory allocator lol)oh and if you want multiple readers and one writer at once instead of restricting both to a single thread there's also RwLock<T>