Scrigroup - Documente si articole

     

HomeDocumenteUploadResurseAlte limbi doc
AccessAdobe photoshopAlgoritmiAutocadBaze de dateCC sharp
CalculatoareCorel drawDot netExcelFox proFrontpageHardware
HtmlInternetJavaLinuxMatlabMs dosPascal
PhpPower pointRetele calculatoareSqlTutorialsWebdesignWindows
WordXml

AspAutocadCDot netExcelFox proHtmlJava
LinuxMathcadPhotoshopPhpSqlVisual studioWindowsXml

The AutoResetEvent Class

c



+ Font mai mare | - Font mai mic



The AutoResetEvent Class

The AutoResetEvent class works in a similar way to the ManualResetEvent class. It waits for the timeout to take place or the event to be signaled and then notifies the waiting threads about the event. One important difference between ManualResetEvent and AutoResetEvent is that AutoResetEvent changes state at the WaitOne( method. The following listing shows the usage of the AutoResetEvent class:



using System;
using System.Threading;

namespace AutoReset



The output from AutoReset is the same as that from the ManualReset example shown earlier:

Before First WaitOne
After First WaitOne True
After Second WaitOne False

In AutoReset, the differences between the AutoResetEvent and ManualResetEvent are clear. The state of the event object changes from signaled to non-signaled at the first WaitOne( , and then it changes state again from non-signaled to signaled at the second WaitOne() method. As a result, the thread does not wait at the first WaitOne( method and has to wait at the second WaitOne() method until the time expires.



Politica de confidentialitate | Termeni si conditii de utilizare



DISTRIBUIE DOCUMENTUL

Comentarii


Vizualizari: 763
Importanta: rank

Comenteaza documentul:

Te rugam sa te autentifici sau sa iti faci cont pentru a putea comenta

Creaza cont nou

Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved