Re: WaitForSingleObject() will not deadlock
- From: Frank Cusack <fcusack@xxxxxxxxxxx>
- Date: Mon, 02 Jul 2007 11:57:44 -0700
Neither does a recursive mutex since a thread other than the one that
acquired the first lock cannot acquire a lock either.
-frank
On Mon, 02 Jul 2007 10:47:10 -0400 Joseph M. Newcomer <newcomer@xxxxxxxxxxxx> wrote:
No, trylock and its equivalents only say that the object is locked..
It does not guarantee that you can lock an object and examine it, so
it won't do the job of walking a circular structure when there are
potentially concurrent walkers.
joe
On Sun, 01 Jul 2007 23:47:50 -0700, Frank Cusack <fcusack@xxxxxxxxxxx> wrote:
On Mon, 02 Jul 2007 01:37:50 -0400 Joseph M. Newcomer <newcomer@xxxxxxxxxxxx> wrote:Joseph M. Newcomer [MVP]
I was not aware that anyone would design a non-recursive mutex,
since this has been an integral part of lock design for at least 20
years, if not longer.
I haven't known our good friend the mutex for so long, but I would
hazard a guess that posix mutexes have ALWAYS had recursion as
an option. Because posix has a non-recursive mutex (by default)
doesn't mean it hasn't also always had a recursive mutex.
I was using recursive-acquisition locks in the late 1980s and they
were a well-known technology at the time I was using them. A
non-recursive mutex is not usable for doing things like traversing
circular lists trying to detect circularity, for example.
Sure it is, use trylock() instead of lock().
-frank
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
- Follow-Ups:
- Re: WaitForSingleObject() will not deadlock
- From: Alexander Grigoriev
- Re: WaitForSingleObject() will not deadlock
- From: Joseph M . Newcomer
- Re: WaitForSingleObject() will not deadlock
- References:
- Re: WaitForSingleObject() will not deadlock
- From: Joseph M . Newcomer
- Re: WaitForSingleObject() will not deadlock
- From: Frank Cusack
- Re: WaitForSingleObject() will not deadlock
- From: Joseph M . Newcomer
- Re: WaitForSingleObject() will not deadlock
- From: Alexander Grigoriev
- Re: WaitForSingleObject() will not deadlock
- From: Joseph M . Newcomer
- Re: WaitForSingleObject() will not deadlock
- From: Frank Cusack
- Re: WaitForSingleObject() will not deadlock
- From: Joseph M . Newcomer
- Re: WaitForSingleObject() will not deadlock
- Prev by Date: Re: Image Viewer using ATL COM
- Next by Date: Re: Printers. How many sheets of paper left.
- Previous by thread: Re: WaitForSingleObject() will not deadlock
- Next by thread: Re: WaitForSingleObject() will not deadlock
- Index(es):
Loading