Re: Shared memory across threads

Tech-Archive recommends: Fix windows errors by optimizing your registry



Question: If I use "lock", shall I use it in both the callback methods
on both threads?
Yes. Its the only safe way to alter or read a collection from more than 1
thread.

Why does your worker thread have to enumerate the whole list? Is it looking
for something in particular to act on? Instead of searching through the
whole list every time, would an event work better? You may find if you take
a step back and look at the problem again you don't have to enumerate the
whole collection repeatedly. It's difficult to be more specific without
knowing the details, of course.

=======
- Adam.

"Curious" <fir5tsight@xxxxxxxxx> wrote in message
news:2710df78-5c41-4981-8666-14535241f20a@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
The callback method is huge and long on thread two. If I use "lock" in
it, it'll block other thread for a long time.

Question: If I use "lock", shall I use it in both the callback methods
on both threads?


.



Relevant Pages

  • Re: Monitor system
    ... sure your ASP.NET worker thread has permissions to enumerate the processes ... Eric Lawrence ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: So it begins - a climate of hate breeds murder
    ... Wasn't it Walter Cronkite who used to say: "These are the events that alter ... and enumerate our times." ... Isn't the correct current legal term "rendition"? ...
    (alt.smokers.cigars)
  • Re: So it begins - a climate of hate breeds murder
    ... Wasn't it Walter Cronkite who used to say: "These are the events that alter ... and enumerate our times." ... he would be "exonerated back to America." ...
    (alt.smokers.cigars)
  • Re: So it begins - a climate of hate breeds murder
    ... Wasn't it Walter Cronkite who used to say: "These are the events that alter ... and enumerate our times." ... "Official ASC Shaman" ...
    (alt.smokers.cigars)