Re: recursive mutexes
From: David Schwartz (davids_at_webmaster.com)
Date: 05/15/05
- Next message: moi: "Re: Calling a Function in Shared Memory"
- Previous message: Zheng Da: "It seems gdb can not work well for c++ program"
- In reply to: Uenal Mutlu: "Re: recursive mutexes"
- Next in thread: Uenal Mutlu: "Re: recursive mutexes"
- Reply: Uenal Mutlu: "Re: recursive mutexes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 15 May 2005 03:13:43 -0700
"Uenal Mutlu" <520001085531-0001@t-online.de> wrote in message
news:d66ogb$2fe$00$1@news.t-online.com...
> C and E are redundant, however application code (the current thread)
> cannot always know that it alread has the lock, though it could test for
> it.
Yes, it can and must know that it already has the lock. A function that
operates on X should be defined as being called with X locked, or with X
unlocked. It could even take a boolean that indicates whether the caller has
locked the object or not, though this is rarely the right thing to do.
Simply put, the only thing recursive mutexes gives you is the ability to
write code that deals with X that can be called whether or not X is locked.
This is not only almost never useful, but it's almost always dangerous.
DS
- Next message: moi: "Re: Calling a Function in Shared Memory"
- Previous message: Zheng Da: "It seems gdb can not work well for c++ program"
- In reply to: Uenal Mutlu: "Re: recursive mutexes"
- Next in thread: Uenal Mutlu: "Re: recursive mutexes"
- Reply: Uenal Mutlu: "Re: recursive mutexes"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|