c - Unlocking an already unlocked thread -
c - Unlocking an already unlocked thread -
in running old code, have found place trying unlock unlocked mutex.
i clear unlocking unlocked mutex lead undefined behaviour.
but doubts are
am able predict behaviour checking compiler documentation? is there chances may lead blocking of thread (deadlock)? undefined behaviour seen onpthread_mutex_unlock
unlocking unlocked thread? or undefined behaviour can seen on of next pthread calls ?
am able predict behaviour checking compiler documentation?
if compiler says behavior be, if utilize compiler (and retains behavior) can rely on behavior.
is there chances may lead blocking of thread (deadlock)?
yes. ub can lead anything. if, example, unlock function unconditionally decrements lock count, underflow, keeping mutex locked forever.
undefined behaviour seen on pthread_mutex_unlock unlocking unlocked thread? or undefined behaviour can seen on of next pthread calls ?
you asking how behavior defined. undefined. can happen @ time after point, @ to the lowest degree far posix pthreads standard says. unless else specifies happen, can @ , officially have no right complain.
c multithreading pthreads undefined-behavior compiler-specific
Comments
Post a Comment