CheckArray (collections);
WaitHandle[] wait_table = null;
while (true) {
- int index = 0;
for (int i = 0; i < collections.Length; ++i) {
if (collections [i].TryTake (out item))
return i;
}
WaitHandle.WaitAny (wait_table);
}
- return -1;
}
public static int TakeFromAny (BlockingCollection<T>[] collections, out T item, CancellationToken cancellationToken)
CheckArray (collections);
WaitHandle[] wait_table = null;
while (true) {
- int index = 0;
for (int i = 0; i < collections.Length; ++i) {
if (collections [i].TryTake (out item))
return i;
WaitHandle.WaitAny (wait_table);
cancellationToken.ThrowIfCancellationRequested ();
}
-
- return -1;
}
public static int TryTakeFromAny (BlockingCollection<T>[] collections, out T item)
internal class TraceImplSettings {
public const string Key = ".__TraceInfoSettingsKey__.";
- public bool AutoFlush;
//public int IndentLevel;
public int IndentSize = 4;
public TraceListenerCollection Listeners = new TraceListenerCollection (false);
private static bool autoFlush;
-#if TARGET_JVM
- static readonly LocalDataStoreSlot _indentLevelStore = System.Threading.Thread.AllocateDataSlot ();
- static readonly LocalDataStoreSlot _indentSizeStore = System.Threading.Thread.AllocateDataSlot ();
-
- private static int indentLevel {
- get {
- object o = System.Threading.Thread.GetData (_indentLevelStore);
- if (o == null)
- return 0;
- return (int) o;
- }
- set { System.Threading.Thread.SetData (_indentLevelStore, value); }
- }
-
- private static int indentSize {
- get {
- object o = System.Threading.Thread.GetData (_indentSizeStore);
- if (o == null)
- return 0;
- return (int) o;
- }
- set { System.Threading.Thread.SetData (_indentSizeStore, value); }
- }
-#else
[ThreadStatic]
private static int indentLevel;
[ThreadStatic]
private static int indentSize;
-#endif
#if MOBILE
static TraceListenerCollection listeners = new TraceListenerCollection (true);
d.Remove (TraceImplSettings.Key);
- autoFlush = s.AutoFlush;
+// autoFlush = s.AutoFlush;
// indentLevel = s.IndentLevel;
indentSize = s.IndentSize;
listeners = s.Listeners;
#else
extern alias PrebuiltSystem;
using X509CertificateCollection = PrebuiltSystem::System.Security.Cryptography.X509Certificates.X509CertificateCollection;
+using System.Security.Cryptography.X509Certificates;
#endif
#endif
using System.Net;
using System.Net.Mime;
using System.Net.Sockets;
-using System.Security.Cryptography.X509Certificates;
using System.Text;
using System.Threading;
using System.Reflection;
[MonoTODO("Only works on Linux. Returns 0 on other systems.")]
public static int LoopbackInterfaceIndex {
get {
+ // Disable warning for code not reachable, due to runningOnUnix being always true on Monotouch
+#pragma warning disable 162
if (runningOnUnix) {
try {
return UnixNetworkInterface.IfNameToIndex ("lo");
}
} else
return 0;
+#pragma warning restore 162
}
}
if (!allowBuffering || writeBuffer == null)
return null;
- byte[] bytes = writeBuffer.GetBuffer ();
+ // Keep the call for a potential side-effect of GetBuffer
+ writeBuffer.GetBuffer ();
int length = (int)writeBuffer.Length;
if (request.ContentLength != -1 && request.ContentLength < length) {
nextReadCalled = true;