|
Next: Cannot start communications with the desktop comp..
|
| Author |
Message |
External

Since: Aug 14, 2009 Posts: 2
|
(Msg. 1) Posted: Fri Aug 14, 2009 12:25 am
Post subject: Are the Set and Reset method of ManualResetEvent class atomic? Archived from groups: microsoft>public>pocketpc>developer (more info?)
|
|
|
|
| I have many threads in my C# program, and I used ManualResetEvent for
suspending the working thread which could be waked by other threads.
Since many threads can calling the Set method, I would ask whether the Set
and Reset method of ManualResetEvent are atomic?
Thanks!
|
|
|
| Back to top |
|
 |  |
External

Since: Apr 21, 2008 Posts: 18
|
(Msg. 2) Posted: Fri Aug 14, 2009 12:25 am
Post subject: Re: Are the Set and Reset method of ManualResetEvent class atomic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Atomicity of them shouldn't matter. When Set is called, an exact, defined
behavior will occur for what wait objects get released. The behavior
changes whether Set or Pulse is called and whether it is an auto or manual
reset type of event. IIRC, the CF doesn't support Pulse, but you can look
at the API docs for CreateEvent to see ecaxtly what happens for each type in
each case.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
"Tony" <zmc.RemoveThis@263.net> wrote in message
news:%23IXQKuIHKHA.4168@TK2MSFTNGP05.phx.gbl...
>I have many threads in my C# program, and I used ManualResetEvent for
>suspending the working thread which could be waked by other threads.
> Since many threads can calling the Set method, I would ask whether the Set
> and Reset method of ManualResetEvent are atomic?
>
> Thanks!
> |
|
| Back to top |
|
 |  |
External

Since: Jul 28, 2009 Posts: 5
|
(Msg. 3) Posted: Fri Aug 14, 2009 2:00 am
Post subject: Re: Are the Set and Reset method of ManualResetEvent class atomic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Look at this
http://stackoverflow.com/questions/265026/is-setevent-atomic
HTH,
Onkar
http://www.42gears.com
On Aug 14, 10:32 am, "Tony" <z... DeleteThis @263.net> wrote:
> OK, thanks!
> But I still have some doubt whether multi-threads call the Set method of the
> same ManualRestEvent simultaneously.
>
> "Chris Tacke, MVP" <ctacke.at.opennetcf.dot.com>
> wrote:3F2502AF-AD2C-4971-A1B0-C879C12DD...@microsoft.com...
>
> > Atomicity of them shouldn't matter. When Set is called, an exact, defined
> > behavior will occur for what wait objects get released. The behavior
> > changes whether Set or Pulse is called and whether it is an auto or manual
> > reset type of event. IIRC, the CF doesn't support Pulse, but you can look
> > at the API docs for CreateEvent to see ecaxtly what happens for each type
> > in each case.
>
> > --
>
> > Chris Tacke, Embedded MVP
> > OpenNETCF Consulting
> > Giving back to the embedded community
> >http://community.OpenNETCF.com
>
> > "Tony" <z... DeleteThis @263.net> wrote in message
> >news:%23IXQKuIHKHA.4168@TK2MSFTNGP05.phx.gbl...
> >>I have many threads in my C# program, and I used ManualResetEvent for
> >>suspending the working thread which could be waked by other threads.
> >> Since many threads can calling the Set method, I would ask whether the
> >> Set and Reset method of ManualResetEvent are atomic?
>
> >> Thanks! |
|
| Back to top |
|
 |  |
External

Since: Aug 14, 2009 Posts: 2
|
(Msg. 4) Posted: Fri Aug 14, 2009 2:25 am
Post subject: Re: Are the Set and Reset method of ManualResetEvent class atomic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
OK, thanks!
But I still have some doubt whether multi-threads call the Set method of the
same ManualRestEvent simultaneously.
"Chris Tacke, MVP" <ctacke.at.opennetcf.dot.com>
wrote:3F2502AF-AD2C-4971-A1B0-C879C12DD2B6@microsoft.com...
> Atomicity of them shouldn't matter. When Set is called, an exact, defined
> behavior will occur for what wait objects get released. The behavior
> changes whether Set or Pulse is called and whether it is an auto or manual
> reset type of event. IIRC, the CF doesn't support Pulse, but you can look
> at the API docs for CreateEvent to see ecaxtly what happens for each type
> in each case.
>
>
> --
>
> Chris Tacke, Embedded MVP
> OpenNETCF Consulting
> Giving back to the embedded community
> http://community.OpenNETCF.com
>
>
> "Tony" <zmc.DeleteThis@263.net> wrote in message
> news:%23IXQKuIHKHA.4168@TK2MSFTNGP05.phx.gbl...
>>I have many threads in my C# program, and I used ManualResetEvent for
>>suspending the working thread which could be waked by other threads.
>> Since many threads can calling the Set method, I would ask whether the
>> Set and Reset method of ManualResetEvent are atomic?
>>
>> Thanks!
>>
> |
|
| Back to top |
|
 |  |
External

Since: Apr 21, 2008 Posts: 18
|
(Msg. 5) Posted: Fri Aug 14, 2009 4:45 pm
Post subject: Re: Are the Set and Reset method of ManualResetEvent class atomic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
There is no such thing as "simultaneous". The processor is executing one
and only one instruction at a time, so if two threads call Set, only one of
them will change its state from non-signalled to signalled. The second one
there becomes a no-op (as it's already signalled). Now *if* you have two
threads waiting on it, and it's an auto-reset event, then both threads will
get released. Which particular caller release which listener would be
non-deterministic, but if that's relevent then you shouldn't be using a
single event anyway.
--
Chris Tacke, Embedded MVP
OpenNETCF Consulting
Giving back to the embedded community
http://community.OpenNETCF.com
"Tony" <zmc.RemoveThis@263.net> wrote in message
news:O9wx1CKHKHA.4024@TK2MSFTNGP02.phx.gbl...
> OK, thanks!
> But I still have some doubt whether multi-threads call the Set method of
> the same ManualRestEvent simultaneously.
>
> "Chris Tacke, MVP" <ctacke.at.opennetcf.dot.com>
> wrote:3F2502AF-AD2C-4971-A1B0-C879C12DD2B6@microsoft.com...
>> Atomicity of them shouldn't matter. When Set is called, an exact,
>> defined behavior will occur for what wait objects get released. The
>> behavior changes whether Set or Pulse is called and whether it is an auto
>> or manual reset type of event. IIRC, the CF doesn't support Pulse, but
>> you can look at the API docs for CreateEvent to see ecaxtly what happens
>> for each type in each case.
>>
>>
>> --
>>
>> Chris Tacke, Embedded MVP
>> OpenNETCF Consulting
>> Giving back to the embedded community
>> http://community.OpenNETCF.com
>>
>>
>> "Tony" <zmc.RemoveThis@263.net> wrote in message
>> news:%23IXQKuIHKHA.4168@TK2MSFTNGP05.phx.gbl...
>>>I have many threads in my C# program, and I used ManualResetEvent for
>>>suspending the working thread which could be waked by other threads.
>>> Since many threads can calling the Set method, I would ask whether the
>>> Set and Reset method of ManualResetEvent are atomic?
>>>
>>> Thanks!
>>>
>>
>
> |
|
| Back to top |
|
 |  |
| Related Topics: | Method override - Hi, I'm trying to build a project that overrides a method of an abstract class in another project. I keep getting the following error: "no suitable method found to override". Does any have any ideas on what i'm missing? Thanks in advance
Best Method for File Storage - I'm toying with writing my own PocketPC application. I'm using .NET and C#. This application needs to store a tree structure with text of varying lengths associated with each node. What is the recommended way to store this data on a PocketPC? I have a...
Restrict method : syntax error - hi, i'm using WM5.0 and Visual studio 2005. I'm trying to select specifics appointments form the calendar using the restrict method and then delete them . I have a string syntax error .I have tried many syntax but i can't find one that works. Can someon...
Works ReadXmlSchema Method on .Net compact framework? - Hello, On Pocket PC (Version 4.20.1081) I experience a (huge) difference between ReadXmlSchema (/mDataSet.ReadXml(lXmlTextReader, XmlReadMode.Auto)/) on a dataset and WriteXml (/mDataSet.WriteXml(lXmlTextWriter, XmlWriteMode.WriteSchema)/). It seems...
Still Image Capture : Error in RenderStream Method of ICap.. - Hello All, I have written a Still Image capture application for pocket pc device after following sample code "CameraCapture" as given in SDK. This application is dialog based application in which i preview live video from camera .It works fi... |
|
You can post new topics in this forum You can reply to topics in this forum You can edit your posts in this forum You can delete your posts in this forum You can vote in polls in this forum
|
|
|
|