Is it possible to specify the type of an object as not being safe to pass between tasks, such as a database connection or an RCall instance which is inherently synchronous? If I make a mistake I usually just get a seg fault. The analogy in Rust would be an error when trying to use an object which doesn’t implement the Send trait.
No. The only thing you can do is add lock to all the operation to it. It really depends on what operation on the object is not safe, it would be good to have more concrete examples. Even for a DB connection or whatever, print() is thread safe, so it’s not meaningful to say everything is not thread safe.