Remove an inexistent icall added by mistake by 0ff40ae70aa2ffbdf61a9ebb5e47e4932864460a.
[mono.git] / mcs / class / corlib / System.Threading / Volatile.cs
1 //
2 // Volatile.cs
3 //
4 // Authors:
5 //       Marek Safar (marek.safar@gmail.com)
6 //
7 // Copyright 2011 Xamarin, Inc (http://www.xamarin.com)
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be included in
17 // all copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 // THE SOFTWARE.
26
27 #if NET_4_5
28
29 using System.Runtime.ConstrainedExecution;
30 using System.Runtime.CompilerServices;
31
32 namespace System.Threading
33 {
34         public static class Volatile
35         {
36                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
37                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
38                 public extern static bool Read (ref bool location);
39
40                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
41                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
42                 public extern static byte Read (ref byte location);
43
44                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
45                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
46                 [CLSCompliant (false)]
47                 public extern static sbyte Read (ref sbyte location);
48
49                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
50                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
51                 public extern static short Read (ref short location);
52
53                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
54                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
55                 [CLSCompliant (false)]
56                 public extern static ushort Read (ref ushort location);
57
58                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
59                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
60                 public extern static int Read (ref int location);
61
62                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
63                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
64                 [CLSCompliant (false)]
65                 public extern static uint Read (ref uint location);
66
67                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
68                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
69                 public extern static long Read (ref long location);
70
71                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
72                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
73                 [CLSCompliant (false)]
74                 public extern static ulong Read (ref ulong location);
75
76                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
77                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
78                 public extern static IntPtr Read (ref IntPtr location);
79
80                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
81                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
82                 [CLSCompliant (false)]
83                 public extern static UIntPtr Read (ref UIntPtr location);
84
85                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
86                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
87                 public extern static double Read (ref double location);
88
89                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
90                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
91                 public extern static float Read (ref float location);
92
93                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
94                 public extern static T Read<T> (ref T location) where T : class;
95
96                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
97                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
98                 public extern static void Write (ref bool location, bool value);
99
100                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
101                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
102                 public extern static void Write (ref byte location, byte value);
103
104                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
105                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
106                 [CLSCompliant (false)]
107                 public extern static void Write (ref sbyte location, sbyte value);
108
109                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
110                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
111                 public extern static void Write (ref short location, short value);
112
113                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
114                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
115                 [CLSCompliant (false)]
116                 public extern static void Write (ref ushort location, ushort value);
117
118                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
119                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
120                 public extern static void Write (ref int location, int value);
121
122                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
123                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
124                 [CLSCompliant (false)]
125                 public extern static void Write (ref uint location, uint value);
126
127                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
128                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
129                 public extern static void Write (ref long location, long value);
130
131                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
132                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
133                 [CLSCompliant (false)]
134                 public extern static void Write (ref ulong location, ulong value);
135
136                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
137                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
138                 public extern static void Write (ref IntPtr location, IntPtr value);
139
140                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
141                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
142                 [CLSCompliant (false)]
143                 public extern static void Write (ref UIntPtr location, UIntPtr value);
144
145                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
146                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
147                 public extern static void Write (ref double location, double value);
148
149                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
150                 [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
151                 public extern static void Write (ref float location, float value);
152
153                 [MethodImplAttribute (MethodImplOptions.InternalCall)]
154                 public extern static void Write<T>(ref T location, T value) where T : class;
155         }
156 }
157
158 #endif