/
Exchanger.xml
391 lines (388 loc) · 24.9 KB
/
Exchanger.xml
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
<Type Name="Exchanger" FullName="Java.Util.Concurrent.Exchanger">
<TypeSignature Language="C#" Value="public class Exchanger : Java.Lang.Object" />
<TypeSignature Language="ILAsm" Value=".class public auto ansi beforefieldinit Exchanger extends Java.Lang.Object" />
<TypeSignature Language="DocId" Value="T:Java.Util.Concurrent.Exchanger" />
<TypeSignature Language="F#" Value="type Exchanger = class
 inherit Object" />
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Base>
<BaseTypeName>Java.Lang.Object</BaseTypeName>
</Base>
<Interfaces />
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register("java/util/concurrent/Exchanger", DoNotGenerateAcw=true)]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register("java/util/concurrent/Exchanger", DoNotGenerateAcw=true)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[Java.Interop.JavaTypeParameters(new System.String[] { "V" })]</AttributeName>
<AttributeName Language="F#">[<Java.Interop.JavaTypeParameters(new System.String[] { "V" })>]</AttributeName>
</Attribute>
</Attributes>
<Docs since="1">
<param name="<V><V>">The type of objects that may be exchanged</param>
<summary>A synchronization point at which threads can pair and swap elements
within pairs.</summary>
<remarks>
<para>A synchronization point at which threads can pair and swap elements
within pairs. Each thread presents some object on entry to the
<c>#exchange exchange</c> method, matches with a partner thread,
and receives its partner's object on return. An Exchanger may be
viewed as a bidirectional form of a <c>SynchronousQueue</c>.
Exchangers may be useful in applications such as genetic algorithms
and pipeline designs.</para>
<para><b>Sample Usage:</b>
Here are the highlights of a class that uses an <c>Exchanger</c>
to swap buffers between threads so that the thread filling the
buffer gets a freshly emptied one when it needs it, handing off the
filled one to the thread emptying the buffer.</para>
<code lang="text/java">{@code
class FillAndEmpty {
Exchanger<DataBuffer> exchanger = new Exchanger<>();
DataBuffer initialEmptyBuffer = ...; // a made-up type
DataBuffer initialFullBuffer = ...;
class FillingLoop implements Runnable {
public void run() {
DataBuffer currentBuffer = initialEmptyBuffer;
try {
while (currentBuffer != null) {
addToBuffer(currentBuffer);
if (currentBuffer.isFull())
currentBuffer = exchanger.exchange(currentBuffer);
}
} catch (InterruptedException ex) { ... handle ...}
}
}
class EmptyingLoop implements Runnable {
public void run() {
DataBuffer currentBuffer = initialFullBuffer;
try {
while (currentBuffer != null) {
takeFromBuffer(currentBuffer);
if (currentBuffer.isEmpty())
currentBuffer = exchanger.exchange(currentBuffer);
}
} catch (InterruptedException ex) { ... handle ...}
}
}
void start() {
new Thread(new FillingLoop()).start();
new Thread(new EmptyingLoop()).start();
}
}}</code>
<para>Memory consistency effects: For each pair of threads that
successfully exchange objects via an <c>Exchanger</c>, actions
prior to the <c>exchange()</c> in each thread
<i>happen-before</i>
those subsequent to a return from the corresponding <c>exchange()</c>
in the other thread.</para>
<para>Added in 1.5.</para>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/java/util/concurrent/Exchanger" title="Reference documentation">Java documentation for <code>java.util.concurrent.Exchanger</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
<since version="Added in API level 1" />
</Docs>
<Members>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="public Exchanger ();" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig specialname rtspecialname instance void .ctor() cil managed" />
<MemberSignature Language="DocId" Value="M:Java.Util.Concurrent.Exchanger.#ctor" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register(".ctor", "()V", "")]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register(".ctor", "()V", "")>]</AttributeName>
</Attribute>
</Attributes>
<Parameters />
<Docs>
<summary>Creates a new Exchanger.</summary>
<remarks>
<para>Creates a new Exchanger.</para>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/java/util/concurrent/Exchanger#Exchanger()" title="Reference documentation">Java documentation for <code>java.util.concurrent.Exchanger.Exchanger()</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
<since version="Added in API level 1" />
</Docs>
</Member>
<Member MemberName=".ctor">
<MemberSignature Language="C#" Value="protected Exchanger (IntPtr javaReference, Android.Runtime.JniHandleOwnership transfer);" />
<MemberSignature Language="ILAsm" Value=".method familyhidebysig specialname rtspecialname instance void .ctor(native int javaReference, valuetype Android.Runtime.JniHandleOwnership transfer) cil managed" />
<MemberSignature Language="DocId" Value="M:Java.Util.Concurrent.Exchanger.#ctor(System.IntPtr,Android.Runtime.JniHandleOwnership)" />
<MemberSignature Language="F#" Value="new Java.Util.Concurrent.Exchanger : nativeint * Android.Runtime.JniHandleOwnership -> Java.Util.Concurrent.Exchanger" Usage="new Java.Util.Concurrent.Exchanger (javaReference, transfer)" />
<MemberType>Constructor</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Parameters>
<Parameter Name="javaReference" Type="System.IntPtr" />
<Parameter Name="transfer" Type="Android.Runtime.JniHandleOwnership" />
</Parameters>
<Docs>
<param name="javaReference">A <see cref="T:System.IntPtr" />containing a Java Native Interface (JNI) object reference.</param>
<param name="transfer">A <see cref="T:Android.Runtime.JniHandleOwnership" />indicating how to handle <paramref name="javaReference" /></param>
<summary>A constructor used when creating managed representations of JNI objects; called by the runtime.</summary>
<remarks>
<para>Portions of this page are modifications based on work created and shared by the <format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format> and used according to terms described in the <format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
</Docs>
</Member>
<Member MemberName="Exchange">
<MemberSignature Language="C#" Value="public virtual Java.Lang.Object? Exchange (Java.Lang.Object? x);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Java.Lang.Object Exchange(class Java.Lang.Object x) cil managed" />
<MemberSignature Language="DocId" Value="M:Java.Util.Concurrent.Exchanger.Exchange(Java.Lang.Object)" />
<MemberSignature Language="F#" Value="abstract member Exchange : Java.Lang.Object -> Java.Lang.Object
override this.Exchange : Java.Lang.Object -> Java.Lang.Object" Usage="exchanger.Exchange x" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register("exchange", "(Ljava/lang/Object;)Ljava/lang/Object;", "GetExchange_Ljava_lang_Object_Handler")]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register("exchange", "(Ljava/lang/Object;)Ljava/lang/Object;", "GetExchange_Ljava_lang_Object_Handler")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>Java.Lang.Object</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="x" Type="Java.Lang.Object" />
</Parameters>
<Docs>
<param name="x">the object to exchange</param>
<summary>Waits for another thread to arrive at this exchange point (unless
the current thread is Thread#interrupt interrupted),
and then transfers the given object to it, receiving its object
in return.</summary>
<returns>the object provided by the other thread</returns>
<remarks>
<para>Waits for another thread to arrive at this exchange point (unless
the current thread is Thread#interrupt interrupted),
and then transfers the given object to it, receiving its object
in return.</para>
<para>If another thread is already waiting at the exchange point then
it is resumed for thread scheduling purposes and receives the object
passed in by the current thread. The current thread returns immediately,
receiving the object passed to the exchange by that other thread.</para>
<para>If no other thread is already waiting at the exchange then the
current thread is disabled for thread scheduling purposes and lies
dormant until one of two things happens:
<ul>
<li>Some other thread enters the exchange; or
<li>Some other thread Thread#interrupt interrupts
the current thread.
</ul></para>
<para>If the current thread:
<ul>
<li>has its interrupted status set on entry to this method; or
<li>is Thread#interrupt interrupted while waiting
for the exchange,
</ul>
then <c>InterruptedException</c> is thrown and the current thread's
interrupted status is cleared.</para>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/java/util/concurrent/Exchanger#exchange(V)" title="Reference documentation">Java documentation for <code>java.util.concurrent.Exchanger.exchange(V)</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
</Docs>
</Member>
<Member MemberName="Exchange">
<MemberSignature Language="C#" Value="public virtual Java.Lang.Object? Exchange (Java.Lang.Object? x, long timeout, Java.Util.Concurrent.TimeUnit? unit);" />
<MemberSignature Language="ILAsm" Value=".method public hidebysig newslot virtual instance class Java.Lang.Object Exchange(class Java.Lang.Object x, int64 timeout, class Java.Util.Concurrent.TimeUnit unit) cil managed" />
<MemberSignature Language="DocId" Value="M:Java.Util.Concurrent.Exchanger.Exchange(Java.Lang.Object,System.Int64,Java.Util.Concurrent.TimeUnit)" />
<MemberSignature Language="F#" Value="abstract member Exchange : Java.Lang.Object * int64 * Java.Util.Concurrent.TimeUnit -> Java.Lang.Object
override this.Exchange : Java.Lang.Object * int64 * Java.Util.Concurrent.TimeUnit -> Java.Lang.Object" Usage="exchanger.Exchange (x, timeout, unit)" />
<MemberType>Method</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[Android.Runtime.Register("exchange", "(Ljava/lang/Object;JLjava/util/concurrent/TimeUnit;)Ljava/lang/Object;", "GetExchange_Ljava_lang_Object_JLjava_util_concurrent_TimeUnit_Handler")]</AttributeName>
<AttributeName Language="F#">[<Android.Runtime.Register("exchange", "(Ljava/lang/Object;JLjava/util/concurrent/TimeUnit;)Ljava/lang/Object;", "GetExchange_Ljava_lang_Object_JLjava_util_concurrent_TimeUnit_Handler")>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>Java.Lang.Object</ReturnType>
</ReturnValue>
<Parameters>
<Parameter Name="x" Type="Java.Lang.Object" />
<Parameter Name="timeout" Type="System.Int64" />
<Parameter Name="unit" Type="Java.Util.Concurrent.TimeUnit" />
</Parameters>
<Docs>
<param name="x">the object to exchange</param>
<param name="timeout">the maximum time to wait</param>
<param name="unit">the time unit of the <c>timeout</c> argument</param>
<summary>Waits for another thread to arrive at this exchange point (unless
the current thread is Thread#interrupt interrupted or
the specified waiting time elapses), and then transfers the given
object to it, receiving its object in return.</summary>
<returns>the object provided by the other thread</returns>
<remarks>
<para>Waits for another thread to arrive at this exchange point (unless
the current thread is Thread#interrupt interrupted or
the specified waiting time elapses), and then transfers the given
object to it, receiving its object in return.</para>
<para>If another thread is already waiting at the exchange point then
it is resumed for thread scheduling purposes and receives the object
passed in by the current thread. The current thread returns immediately,
receiving the object passed to the exchange by that other thread.</para>
<para>If no other thread is already waiting at the exchange then the
current thread is disabled for thread scheduling purposes and lies
dormant until one of three things happens:
<ul>
<li>Some other thread enters the exchange; or
<li>Some other thread Thread#interrupt interrupts
the current thread; or
<li>The specified waiting time elapses.
</ul></para>
<para>If the current thread:
<ul>
<li>has its interrupted status set on entry to this method; or
<li>is Thread#interrupt interrupted while waiting
for the exchange,
</ul>
then <c>InterruptedException</c> is thrown and the current thread's
interrupted status is cleared.</para>
<para>If the specified waiting time elapses then <c>TimeoutException</c> is thrown. If the time is less than or equal
to zero, the method will not wait at all.</para>
<para>
<format type="text/html">
<a href="https://developer.android.com/reference/java/util/concurrent/Exchanger#exchange(V,%20long,%20java.util.concurrent.TimeUnit)" title="Reference documentation">Java documentation for <code>java.util.concurrent.Exchanger.exchange(V, long, java.util.concurrent.TimeUnit)</code>.</a>
</format>
</para>
<para>
Portions of this page are modifications based on work created and shared by the
<format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format>
and used according to terms described in the
<format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
</Docs>
</Member>
<Member MemberName="JniPeerMembers">
<MemberSignature Language="C#" Value="public override Java.Interop.JniPeerMembers JniPeerMembers { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class Java.Interop.JniPeerMembers JniPeerMembers" />
<MemberSignature Language="DocId" Value="P:Java.Util.Concurrent.Exchanger.JniPeerMembers" />
<MemberSignature Language="F#" Value="member this.JniPeerMembers : Java.Interop.JniPeerMembers" Usage="Java.Util.Concurrent.Exchanger.JniPeerMembers" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>Java.Interop.JniPeerMembers</ReturnType>
</ReturnValue>
<Docs>
<summary>To be added.</summary>
<value>To be added.</value>
<remarks>
<para>Portions of this page are modifications based on work created and shared by the <format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format> and used according to terms described in the <format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
</Docs>
</Member>
<Member MemberName="ThresholdClass">
<MemberSignature Language="C#" Value="protected override IntPtr ThresholdClass { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance native int ThresholdClass" />
<MemberSignature Language="DocId" Value="P:Java.Util.Concurrent.Exchanger.ThresholdClass" />
<MemberSignature Language="F#" Value="member this.ThresholdClass : nativeint" Usage="Java.Util.Concurrent.Exchanger.ThresholdClass" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.IntPtr</ReturnType>
</ReturnValue>
<Docs>
<summary>This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.</summary>
<value>A <see cref="T:System.IntPtr" /> which contains the <c>java.lang.Class</c> JNI value corresponding to this type.</value>
<remarks>
<para>Portions of this page are modifications based on work created and shared by the <format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format> and used according to terms described in the <format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
</Docs>
</Member>
<Member MemberName="ThresholdType">
<MemberSignature Language="C#" Value="protected override Type ThresholdType { get; }" />
<MemberSignature Language="ILAsm" Value=".property instance class System.Type ThresholdType" />
<MemberSignature Language="DocId" Value="P:Java.Util.Concurrent.Exchanger.ThresholdType" />
<MemberSignature Language="F#" Value="member this.ThresholdType : Type" Usage="Java.Util.Concurrent.Exchanger.ThresholdType" />
<MemberType>Property</MemberType>
<AssemblyInfo>
<AssemblyName>Mono.Android</AssemblyName>
<AssemblyVersion>0.0.0.0</AssemblyVersion>
</AssemblyInfo>
<Attributes>
<Attribute>
<AttributeName Language="C#">[System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]</AttributeName>
<AttributeName Language="F#">[<System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)>]</AttributeName>
</Attribute>
<Attribute>
<AttributeName Language="C#">[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]</AttributeName>
<AttributeName Language="F#">[<System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)>]</AttributeName>
</Attribute>
</Attributes>
<ReturnValue>
<ReturnType>System.Type</ReturnType>
</ReturnValue>
<Docs>
<summary>This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.</summary>
<value>A <see cref="T:System.Type" /> which provides the declaring type.</value>
<remarks>
<para>Portions of this page are modifications based on work created and shared by the <format type="text/html"><a href="https://developers.google.com/terms/site-policies" title="Android Open Source Project">Android Open Source Project</a></format> and used according to terms described in the <format type="text/html"><a href="https://creativecommons.org/licenses/by/2.5/" title="Creative Commons 2.5 Attribution License">Creative Commons 2.5 Attribution License.</a></format></para>
</remarks>
</Docs>
</Member>
</Members>
</Type>