Re: Shared memory across threads
- From: "Adam Benson" <Adam.Benson@xxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 19 Jun 2008 14:55:45 +0100
Question: If I use "lock", shall I use it in both the callback methodsYes. Its the only safe way to alter or read a collection from more than 1
on both threads?
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?
.
- Follow-Ups:
- Re: Shared memory across threads
- From: Adam Benson
- Re: Shared memory across threads
- References:
- Shared memory across threads
- From: Curious
- Re: Shared memory across threads
- From: Adam Benson
- Re: Shared memory across threads
- From: Curious
- Shared memory across threads
- Prev by Date: Re: Key preview
- Next by Date: Re: Shared memory across threads
- Previous by thread: Re: Shared memory across threads
- Next by thread: Re: Shared memory across threads
- Index(es):
Relevant Pages
|