ReaderWriterLockSlim + Dispose?
- From: NvrBst <nvrbst@xxxxxxxxx>
- Date: Fri, 4 Apr 2008 16:33:09 -0700 (PDT)
One last question today :) Most locks I've used never had a Dispose
(Monitor, ReaderWriterLock, etc). Looking at the
ReaderWriterLockSlim's Dispose method its just cleaning up some
Threading.WaitHandle's.
Whenever I see a Dispose method I always want to call it after I'm
done with the object. All examples I've ever found online don't use
dispose with the ReaderWriterLockSlim. Making my classes that use
this lock IDisposable for this reasion alone is a little frustrating,
and makes the implementation a little harder (since I have to
constantly check to see if the locks disposed, mainly when using it
with a thread pool).
Since only WaitHandles are getting closed, the GC will eventually
clean them if I ignore the Disposing on the ReaderWriterLockSlim? Is
there performance increases in using the disposable WaitHandles vs how
other locks without Dispose() do it?
Thanks :) I'm mostly just curious.
NB
.
- Follow-Ups:
- Re: ReaderWriterLockSlim + Dispose?
- From: Peter Duniho
- Re: ReaderWriterLockSlim + Dispose?
- Prev by Date: datasets
- Next by Date: Re: OpenFileDialog (Constant Inital Directory)
- Previous by thread: datasets
- Next by thread: Re: ReaderWriterLockSlim + Dispose?
- Index(es):
Relevant Pages
|
Loading