A saw this on Mastodon, and found it interesting. Rust already prevents a lot of race conditions, but deadlocks when using a mutex is still possible (and I have actually had one myself, though I caught it during testing). So, it would be nice if it would be possible to catch these cases at compile time. Now, seems to be just a proof of concept, but it is always nice to see the direction people are going and what areas are explored.

  • Miaou
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    9 months ago

    So this is solving the problem of reentrant deadlocks, with a non compile-time enforceable exclusion mechanism in the form of a threadkey.

    It’s quite different from solving deadlocks in general, and mostly moves the problem to getting the thread key. It’s an interesting thought experiment, but unless I’m missing something else, it has no practical purpose over a try_lock.

    But anyway, thanks for taking the time to explain, I should have read more carefully