Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Doubly linked lists are rare, but backlinks to the owner are often needed. It's the same problem, mostly.


Backlinks work fine with weak Arc references, don’t they?


Yes. 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




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: