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

In my experience it is very to easy get into situations where using only mutexes is impossible. As soon as you need a lock per object and access two objects then you have to make sure to only acquire one lock at a time. The end result is that you are effectively using the stack as a message queue that can only hold one element.


The solution with multiple locks is to always take them in the same defined order on any code path - that guarantees that you can't get into deadlock situations.




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

Search: