CATEGORII DOCUMENTE |
Asp | Autocad | C | Dot net | Excel | Fox pro | Html | Java |
Linux | Mathcad | Photoshop | Php | Sql | Visual studio | Windows | Xml |
Interlocked synchronizes access to an integer variable that is being shared by a number of threads. The operation is carried out in an atomic manner. Let's see an example, WroxInterlocked.cs:
The output for WroxInterLocked is:
Thread ID = 2 Count = 1WroxInterLocked shows the use of the Interlocked class. We increment the value of the global variable i in an atomic manner. Like the Increment() method, there is also a Decrement() method that reduces the value of a variable by one. In the same manner, the Exchange() method changes the value of two variables passed to it as ByRef parameters.
Politica de confidentialitate | Termeni si conditii de utilizare |
Vizualizari: 699
Importanta:
Termeni si conditii de utilizare | Contact
© SCRIGROUP 2024 . All rights reserved