Boo

volatile fields

Details

  • Type: Improvement Improvement
  • Status: Resolved Resolved
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 0.9
  • Fix Version/s: 0.9.1
  • Component/s: Compiler, Emitter
  • Labels:
    None
  • Testcase included:
    yes
  • Number of attachments :
    0

Description

New [volatile] AST attribute that adds required custom modifier System.Runtime.CompilerServices.IsVolatile on a field.
Subsequent accesses (load or store) to such fields have IL "volatile." prefix.
Fields that are declared volatile are not subject to compiler optimizations that assume access by a single thread.
This ensures that the most up-to-date value is present in the field at all times.
Read http://msdn.microsoft.com/en-us/library/x13ttww7.aspx for more information.

Usage:

class Test:
    [volatile]
    public static Value = 42

print Test.Value

Activity

Hide
Cedric Vivier added a comment -

Landed in rev. 3279

Show
Cedric Vivier added a comment - Landed in rev. 3279

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: