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

Now I'm curious. Was the mutex actually necessary, or was the performance increase purchased at the cost of race conditions?


Yeah, the mutex was necessary and it was pretty bloody obvious from looking at few lines of context around those calls.


Unfortunately, most of the time when you come across a mutex you have to assume it's necessary. It's very hard to regression test code after removing a mutex, chances are you are not going to encounter the race condition which the mutex protects against (unless it's well documented, of course).




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: