3 ms·
Doubly linked lists are rare, but backlinks to the owner are often needed. It's the same problem, mostly.
by Animats 1y ago
Doubly linked lists are rare, but backlinks to the owner are often needed.
It's the same problem, mostly.
- mplanchard 1y agoBacklinks work fine with weak Arc references, don’t they?
- Animats 1y agoYes. But the Arc has to wrap a Mutex, which means you have to lock to get access. It's a dual of the Rc/RefCell/borrow mechanism. The trouble with calling .lock() is that there is a potential for deadlock. There are some people working on static analysis for deadlock prevention, which is a dual of the static analysis for double borrow protection problem. We're maybe a PhD thesis or two from a solution. Here's some current research, out of Shanghai.[1] Outlines the theory, but code does not yet seem to be available. [1] https://arxiv.org/pdf/2401.01114 https://arxiv.org/pdf/2401.01114