You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
According to the C11 standard, a dead-lock is undefined behaviour. However, with POSIX threads, the behaviour is well defined. What we want to avoid is client code silently discarding dead-locks, by calling mtx_lock(), without paying attention to the return value, which turns into a no-op. Instead code should crash, at least in debug compiles, so programmers can see that they are relying on a deadlock (which is undefined).
What do you think ?
The text was updated successfully, but these errors were encountered:
In
mtx_lock()
, I think you should trap the dead-lock with an assert:According to the C11 standard, a dead-lock is undefined behaviour. However, with POSIX threads, the behaviour is well defined. What we want to avoid is client code silently discarding dead-locks, by calling
mtx_lock()
, without paying attention to the return value, which turns into a no-op. Instead code should crash, at least in debug compiles, so programmers can see that they are relying on a deadlock (which is undefined).What do you think ?
The text was updated successfully, but these errors were encountered: