Re: Do I need a mutex to access members from different threads?
- From: mind_the_gap <2voodoo@xxxxxx>
- Date: Mon, 7 Jan 2008 02:40:02 -0800 (PST)
On Jan 7, 7:53 am, Freesc <hjd.cl...@xxxxxxxxx> wrote:
On Jan 7, 2:03 am, mind_the_gap <2voo...@xxxxxx> wrote:
Hello there,
currently I am working on a c# project with the .Net Compact Framwork.
I have to use two threads where one of them modifies a member of the
class in regular timed intervals. The "normal" (e.g. the first or
start or main thread :P) thread needs to read this data to display it.
So can this bring up some errors or problems (like asyncronous reading/
writing) and do I need a mutex for writing and reading the data from
different threads?
Are there any examples for this? I am relatively new to threads.
Thanks in advance
Tom
Control.Invoke() method will be a good choice ~
Thanks for the replys.
I tryed with events - the problem with this seems that the event code
is only run in the thread where it was fired - so in my case the
thread that changes the variable.
Or am I missing something. The solution with lock() seems to works - I
think I do this. But maybe I am missing something with those events.
Control.Invoke() can not be used as the "user" of the variable - the
class member using the variable and thus the class - does not extend
Control. This means I can not use this. It seems that lock() is the
keyword for non-control classes?
Thanks
.
- Follow-Ups:
- Re: Do I need a mutex to access members from different threads?
- From: <ctacke/>
- Re: Do I need a mutex to access members from different threads?
- References:
- Do I need a mutex to access members from different threads?
- From: mind_the_gap
- Re: Do I need a mutex to access members from different threads?
- From: Freesc
- Do I need a mutex to access members from different threads?
- Prev by Date: Re: SqlCeConnection path error in .NET compact framework (Pocket PC Em
- Next by Date: cab projects in VS2005
- Previous by thread: Re: Do I need a mutex to access members from different threads?
- Next by thread: Re: Do I need a mutex to access members from different threads?
- Index(es):
Relevant Pages
|