R
Raxit
Hi,
[Sorry for comp.lang.c some folks may find it OT]
In Mulithreaded program, using Posix api, we do
pthread_mutex_lock(&Lock)
do some ops
if/else/if/else...complex stuff
pthread_mutex_unlock.
now assume because of complex if/else/if/else, thread got exited
without unlocking the mutex.
now the funny part is, other thread trying to acquire lock will
block. How to detect which thread [may be exited thread !!!!] has done
some wrong stuff. But how to track them?
Before few days i posted, why not to unlock all mutex acquired by
thread "A" when thread "A" is exiting/finishing/cancelled/thrown outof
system. !
Please note: from my code i can do manually logs and debug message
monitoring and can findout. What i am more interested in is, "How to
Autodetect and how to avoid, even code is done by ***Lazy***
programmer."
Any thought ?
Cheers,
Raxit
[Sorry for comp.lang.c some folks may find it OT]
In Mulithreaded program, using Posix api, we do
pthread_mutex_lock(&Lock)
do some ops
if/else/if/else...complex stuff
pthread_mutex_unlock.
now assume because of complex if/else/if/else, thread got exited
without unlocking the mutex.
now the funny part is, other thread trying to acquire lock will
block. How to detect which thread [may be exited thread !!!!] has done
some wrong stuff. But how to track them?
Before few days i posted, why not to unlock all mutex acquired by
thread "A" when thread "A" is exiting/finishing/cancelled/thrown outof
system. !
Please note: from my code i can do manually logs and debug message
monitoring and can findout. What i am more interested in is, "How to
Autodetect and how to avoid, even code is done by ***Lazy***
programmer."
Any thought ?
Cheers,
Raxit