Re: Lock or semaphore, difference?
- From: jmostert@xxxxxxxxx
- Date: Fri, 12 Dec 2008 00:05:15 -0800 (PST)
On Dec 12, 4:39 am, "Alvin Bruney [ASP.NET MVP]" <vapor dan a t h u t
ma le dut cu m> wrote:
I believe your No should be a Yes. They are practically very different. AsHe asked whether they "execute exactly the same". There's a lot of
you rightly pointed out, one is process wide only, the other is a kernel
object. Consequently, the underlying implementation is very differet - think
spin locks.
leeway in this phrase to answer the question either way. To me, the
important detail was the use of a named semaphore -- this is most
certainly *not* the same as using a lock, not even functionally,
because it requires that you only ever run one instance of your
program. That said, I'll gladly admit I answered "no" because I saw
the opportunity.
Funny thing is, I saw this quite recently as an actual bug. Making the
semaphore anonymous solved the problem. A classic case of not reading
the documentation, and the natural human urge to name things when you
have the opportunity, regardless of whether it's required.
.
- References:
- Lock or semaphore, difference?
- From: Carl
- Re: Lock or semaphore, difference?
- From: Jeroen Mostert
- Re: Lock or semaphore, difference?
- From: Alvin Bruney [ASP.NET MVP]
- Lock or semaphore, difference?
- Prev by Date: Re: Lock or semaphore, difference?
- Next by Date: Endpoint Not Found Exception : There was no endpoint listening
- Previous by thread: Re: Lock or semaphore, difference?
- Next by thread: Re: Lock or semaphore, difference?
- Index(es):
Relevant Pages
|