A thought experiment
Using a Box<T>, is an easy way to put data on the heap instead of the stack. This is good because we don’t always know the size of something before we ingest it. The reference to this is a reference counter smart pointer and is the thing that allows shared ownership.
The main idea is that we can share ownership as much as we would like and the value goes away when the last reference is dropped.
Rc<T> // Is a reference counter pointerWe actually need the following type which is atomic to pass a reference between threads…
Arc<T> // Is an atomic reference counter pointerThere is still the possibility of a deadlock here.