Re: ReaderWriterLockSlim + Dispose?



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
.



Relevant Pages

  • Re: Diversion: Weird dare part deux, wanna play?
    ... Yeah, rotten is bad. ... for the suggestion, ... "Argue for your limitations and sure enough, ...
    (alt.support.stop-smoking)
  • Re: IP Regex and persistant datagrids
    ... > offer a suggestion on how to implement limitation? ... as I already test for the limitations in the code as it is. ... Wayne, if by "limitations" you mean to limit the three-digit fields to ... I'm sure some regex wizard could do better, but normal humans should start ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Book on data structure
    ... > Any suggestion which book to buy to study Data structures and problems ... Take a look at books written by Robert Sedgewick. ...
    (comp.lang.cpp)
  • Re: Bar Graphs
    ... Thanks for your suggestion. ... It's unfortunate that there isn't a better solution but I guess I have to work within the limitations of excel. ...
    (microsoft.public.excel.charting)

Loading