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

Agree about performance, but wouldn't there need to be >1 mutex to risk a deadlock?


Imagine you get a signal during getenv itself with the mutex held. Then your signal handler calls getenv. (On the other hand -- getenv is not marked async-signal-safe, so this use is already illegal.)


If it's not a "recursive mutex" (where you can call lock within the same thread on the same mutex more than once consecutively and it handled that), it's possible to lock on itself again (say in code which is recursive)...




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

Search: