Table of Contents 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 Notes DownloadECMA-334 C# Language Specification 10 Basic concepts 10.10 Execution order
Paragraph 11 Execution shall proceed such that the side effects of each executing thread are preserved at critical execution points. 2 A side effect is defined as a read or write of a volatile field, a write to a non-volatile variable, a write to an external resource, and the throwing of an exception. 3 The critical execution points at which the order of these side effects must be preserved are references to volatile fields (§17.4.3), lock statements (§15.12), and thread creation and termination. 4 An implementation is free to change the order of execution of a C# program, subject to the following constraints:
- 5 Data dependence is preserved within a thread of execution. 6 That is, the value of each variable is computed as if all statements in the thread were executed in original program order.
- 7 Initialization ordering rules are preserved (§17.4.4 and §17.4.5).
- 8 The ordering of side effects is preserved with respect to volatile reads and writes (§17.4.3). 9 Additionally, an implementation need not evaluate part of an expression if it can deduce that that expression's value is not used and that no needed side effects are produced (including any caused by calling a method or accessing a volatile field). 10 When program execution is interrupted by an asynchronous event (such as an exception thrown by another thread), it is not guaranteed that the observable side effects are visible in the original program order.
|Jagger Software Ltd|
|Company # 4070126|
|VAT # 762 5213 42|