Re: Reclaiming locks
- From: Måns Rullgård <mans@xxxxxxxxx>
- Date: Tue, 30 Oct 2007 20:58:27 +0000
Sheth Raxit <raxitsheth2000@xxxxxxxxx> writes:
On Oct 30, 2:13 pm, Måns Rullgård <m...@xxxxxxxxx> wrote:
Sheth Raxit <raxitsheth2...@xxxxxxxxx> writes:
On Oct 30, 2:02 pm, Måns Rullgård <m...@xxxxxxxxx> wrote:
Sheth Raxit <raxitsheth2...@xxxxxxxxx> writes:
On Oct 30, 1:04 am, CJ <diespamm...@xxxxxxxxxxxxxxx> wrote:
Hello Friends -
I've run across the following situation. I have two threads,
say T1 and T2 which access shared data - each locks a mutex
before doing so.
Now I have a hard-to-find bug which means that periodically
T1 gets killed unexpectedly. But if it holds the mutex at
that point, T2 blocks for ever!
How can I get T1 to release any locks it's holding when it
gets killed?
you may want to refer pthread_cleanup_push,pop etc. That is Good Way.
Not really. Using those functions, as well as pthread_cancel(), isWhy ?
never necessary in a good design.
Those functions are only useful if you don't know what your threads
are doing at all times. In a good design you know what's going on,
and there is no need to terminate a thread in an unknown state.
I am being taught it is always good and safer to put clean up code in
multithreaded stuff.
I am telling you it's even safer not to need cleanup in the first place.
--
Måns Rullgård
mans@xxxxxxxxx
.
- References:
- Re: Reclaiming locks
- From: Sheth Raxit
- Re: Reclaiming locks
- From: Måns Rullgård
- Re: Reclaiming locks
- From: Sheth Raxit
- Re: Reclaiming locks
- From: Måns Rullgård
- Re: Reclaiming locks
- From: Sheth Raxit
- Re: Reclaiming locks
- Prev by Date: Re: newbie question about fork/pipe/stdin/stdout
- Next by Date: Re: linking against shared libraries
- Previous by thread: Re: Reclaiming locks
- Next by thread: linking against shared libraries
- Index(es):
Relevant Pages
|