3 ms·
Generics could for instance have helped implement a mutex that disallows access to the memory that needs to be synchronized without locking it first. This of co
by eptcyka 5y ago
Generics could for instance have helped implement a mutex that disallows access to the memory that needs to be synchronized without locking it first. This of course wouldn't have helped here, as the root cause was holding on to the mutex for too long.
I was under the impression that Go had first party tooling for deadlock checking, something called threadanalyzer if I recall correctly.
- masklinn 5y ago> Generics could for instance have helped implement a mutex that disallows access to the memory that needs to be synchronized without locking it first. Did any language actually do that before rust? It's also somewhat less useful without compiler-checked ownership as you can easily have the protected data escape the lock.
- gpderetta 5y agosync-like classes [1] have been used for a long time in C++. I'm pretty sure that Stroustrup had one in his book. Of course it is always easy to subvert this kind of protection in C++ as you can easily leak references outside of the implicit critical section. [1] https://gcc.godbolt.org/z/3Wefz3cjK https://gcc.godbolt.org/z/3Wefz3cjK