3 ms·
Java's take on monitors was definitely not great, and people were emulating mutexes with them even in the language's earliest days. Still there are a lot of th
by foobazgt 2y ago
Java's take on monitors was definitely not great, and people were emulating mutexes with them even in the language's earliest days.
Still there are a lot of things that can go wrong with mutexes: forgetting to unlock in the case of exceptions, priority inversion, recursive locking, deadlock, needlessly high contention, etc.
Java has had an excellent concurrency runtime with abstractions that are typically a better fit than a bare mutex for over 20 years now (c.f. Doug Lea). Synchronized still exists, because of Java's excellent backwards compatibility.