Re: ReaderWriterLockSlim + Dispose?
- From: "Peter Duniho" <NpOeStPeAdM@xxxxxxxxxxxxxxxx>
- Date: Sun, 06 Apr 2008 11:20:37 -0700
On Sun, 06 Apr 2008 11:01:40 -0700, NvrBst <nvrbst@xxxxxxxxx> wrote:
Correct code is in the eye of the beholder. Just because your design
has some limitations or work-arounds doesn't make it defective.
Just because some correct code has some limitations or work-arounds, that does not mean that all code with some limitations or work-arounds is not defective.
But that's not a correct design, if the threads may want to use any of the
data structures you are cleaning up before they complete.
Who says the threads want to use any of the data structures you are
clenaing up.
You did. You specifically said you are talking about cleaning up synchronization data structures that are used by the threads.
Furthermore, there is a "disposed" at their disposal.
if(!disposed) use structure.
If they have the option of not using the structure, then they don't need the structure. In which case you should not have the structure at all.
Conversely, if they need the structure, then you don't have the option of them not using the structure when it's been disposed.
I always read that ThreadPool threads are lightweight; using them like
suggested isn't correct (design wise as you say). If someone is using
it like that then they probably should redesign the solution to not
use the ThreadPool :P
This has nothing at all to do with whether you are using the thread pool or some other mechanism. And I have no idea what you mean by "using them like suggested isn't correct". Using them as _who_ suggested? What suggestion is it that you feel isn't correct?
Not that the answer to that question would have any relevance to the issue I'm writing about in this thread. But your paragraph is amibguous and I'm curious what you actually meant.
Pete
.
- Follow-Ups:
- Re: ReaderWriterLockSlim + Dispose?
- From: NvrBst
- Re: ReaderWriterLockSlim + Dispose?
- References:
- ReaderWriterLockSlim + Dispose?
- From: NvrBst
- Re: ReaderWriterLockSlim + Dispose?
- From: Peter Duniho
- Re: ReaderWriterLockSlim + Dispose?
- From: NvrBst
- Re: ReaderWriterLockSlim + Dispose?
- From: Peter Duniho
- Re: ReaderWriterLockSlim + Dispose?
- From: NvrBst
- Re: ReaderWriterLockSlim + Dispose?
- From: Peter Duniho
- Re: ReaderWriterLockSlim + Dispose?
- From: NvrBst
- Re: ReaderWriterLockSlim + Dispose?
- From: Peter Duniho
- Re: ReaderWriterLockSlim + Dispose?
- From: NvrBst
- ReaderWriterLockSlim + Dispose?
- Prev by Date: Re: Need architectural help to implement caching
- Next by Date: Re: Blocking calls in AsyncCallback?
- Previous by thread: Re: ReaderWriterLockSlim + Dispose?
- Next by thread: Re: ReaderWriterLockSlim + Dispose?
- Index(es):
Relevant Pages
|
Loading