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

I used to think that way, but I've learned that there's one good reason for why the API is designed that way: priority inheritance. Priorities are bound to threads, and, when a high priority threads wants to lock a currently occupied mutex, we want to bump the priority of the current holder. And POSIX requirement makes that easy --- the thread who locked the mutex must be the one holding it.

Related: https://man7.org/linux/man-pages/man2/futex.2.html#:~:text=%...



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

Search: