diff --git a/ThirdParty/SmartThreadPool/CallerThreadContext.cs b/ThirdParty/SmartThreadPool/CallerThreadContext.cs
index cf1c8789e5..d8c65a9727 100644
--- a/ThirdParty/SmartThreadPool/CallerThreadContext.cs
+++ b/ThirdParty/SmartThreadPool/CallerThreadContext.cs
@@ -1,6 +1,4 @@
-#if !(_WINDOWS_CE) && !(_SILVERLIGHT) && !(WINDOWS_PHONE)
-
using System;
using System.Diagnostics;
using System.Threading;
@@ -97,4 +95,3 @@ namespace Amib.Threading.Internal
#endregion
}
-#endif
diff --git a/ThirdParty/SmartThreadPool/Exceptions.cs b/ThirdParty/SmartThreadPool/Exceptions.cs
index 7afa1b5e27..728df853be 100644
--- a/ThirdParty/SmartThreadPool/Exceptions.cs
+++ b/ThirdParty/SmartThreadPool/Exceptions.cs
@@ -1,7 +1,5 @@
using System;
-#if !(_WINDOWS_CE)
using System.Runtime.Serialization;
-#endif
namespace Amib.Threading
{
diff --git a/ThirdParty/SmartThreadPool/SmartThreadPool.cs b/ThirdParty/SmartThreadPool/SmartThreadPool.cs
index 5acef1cad8..6e7cc51bcf 100644
--- a/ThirdParty/SmartThreadPool/SmartThreadPool.cs
+++ b/ThirdParty/SmartThreadPool/SmartThreadPool.cs
@@ -167,13 +167,11 @@ namespace Amib.Threading
///
public static readonly string DefaultPerformanceCounterInstanceName;
-#if !(WINDOWS_PHONE)
-
///
/// The default thread priority (ThreadPriority.Normal)
///
public const ThreadPriority DefaultThreadPriority = ThreadPriority.Normal;
-#endif
+
///
/// The default thread pool name. (SmartThreadPool)
///
@@ -195,14 +193,12 @@ namespace Amib.Threading
///
public const bool DefaultAreThreadsBackground = true;
-#if !(_SILVERLIGHT) && !(WINDOWS_PHONE)
///
/// The default apartment state of a thread in the thread pool.
/// The default is ApartmentState.Unknown which means the STP will not
/// set the apartment of the thread. It will use the .NET default.
///
public const ApartmentState DefaultApartmentState = ApartmentState.Unknown;
-#endif
#endregion
@@ -296,17 +292,9 @@ namespace Amib.Threading
///
private ISTPInstancePerformanceCounters _localPCs = NullSTPInstancePerformanceCounters.Instance;
-
-#if (WINDOWS_PHONE)
- private static readonly Dictionary _threadEntries = new Dictionary();
-#elif (_WINDOWS_CE)
- private static LocalDataStoreSlot _threadEntrySlot = Thread.AllocateDataSlot();
-#else
[ThreadStatic]
private static ThreadEntry _threadEntry;
-#endif
-
///
/// An event to call after a thread is created, but before
/// it's first use.
@@ -329,37 +317,6 @@ namespace Amib.Threading
///
internal static ThreadEntry CurrentThreadEntry
{
-#if (WINDOWS_PHONE)
- get
- {
- lock(_threadEntries)
- {
- ThreadEntry threadEntry;
- if (_threadEntries.TryGetValue(Thread.CurrentThread.ManagedThreadId, out threadEntry))
- {
- return threadEntry;
- }
- }
- return null;
- }
- set
- {
- lock(_threadEntries)
- {
- _threadEntries[Thread.CurrentThread.ManagedThreadId] = value;
- }
- }
-#elif (_WINDOWS_CE)
- get
- {
- //Thread.CurrentThread.ManagedThreadId
- return Thread.GetData(_threadEntrySlot) as ThreadEntry;
- }
- set
- {
- Thread.SetData(_threadEntrySlot, value);
- }
-#else
get
{
return _threadEntry;
@@ -368,7 +325,6 @@ namespace Amib.Threading
{
_threadEntry = value;
}
-#endif
}
#endregion
@@ -453,12 +409,6 @@ namespace Amib.Threading
_isSuspended = _stpStartInfo.StartSuspended;
-#if (_WINDOWS_CE) || (_SILVERLIGHT) || (_MONO) || (WINDOWS_PHONE)
- if (null != _stpStartInfo.PerformanceCounterInstanceName)
- {
- throw new NotSupportedException("Performance counters are not implemented for Compact Framework/Silverlight/Mono, instead use StpStartInfo.EnableLocalPerformanceCounters");
- }
-#else
if (null != _stpStartInfo.PerformanceCounterInstanceName)
{
try
@@ -471,7 +421,6 @@ namespace Amib.Threading
_windowsPCs = NullSTPInstancePerformanceCounters.Instance;
}
}
-#endif
if (_stpStartInfo.EnableLocalPerformanceCounters)
{
@@ -660,27 +609,21 @@ namespace Amib.Threading
// Create a new thread
-#if (_SILVERLIGHT) || (WINDOWS_PHONE)
- Thread workerThread = new Thread(ProcessQueuedItems);
-#else
Thread workerThread =
_stpStartInfo.MaxStackSize.HasValue
? new Thread(ProcessQueuedItems, _stpStartInfo.MaxStackSize.Value)
: new Thread(ProcessQueuedItems);
-#endif
+
// Configure the new thread and start it
workerThread.IsBackground = _stpStartInfo.AreThreadsBackground;
-#if !(_SILVERLIGHT) && !(_WINDOWS_CE) && !(WINDOWS_PHONE)
if (_stpStartInfo.ApartmentState != ApartmentState.Unknown)
{
workerThread.SetApartmentState(_stpStartInfo.ApartmentState);
}
-#endif
-#if !(_SILVERLIGHT) && !(WINDOWS_PHONE)
workerThread.Priority = _stpStartInfo.ThreadPriority;
-#endif
+
workerThread.Name = string.Format("STP:{0}:{1}", Name, _threadCounter);
workerThread.Start();
@@ -850,9 +793,7 @@ namespace Amib.Threading
{
tae.GetHashCode();
// Handle the abort exception gracfully.
-#if !(_WINDOWS_CE) && !(_SILVERLIGHT) && !(WINDOWS_PHONE)
Thread.ResetAbort();
-#endif
}
catch (Exception e)
{
@@ -1009,11 +950,7 @@ namespace Amib.Threading
foreach (Thread thread in threads)
{
- if ((thread != null)
-#if !(_WINDOWS_CE)
- && thread.IsAlive
-#endif
- )
+ if ((thread != null) && thread.IsAlive )
{
try
{
@@ -1041,8 +978,7 @@ namespace Amib.Threading
///
/// true when every work item in workItemResults has completed; otherwise false.
///
- public static bool WaitAll(
- IWaitableResult[] waitableResults)
+ public static bool WaitAll( IWaitableResult[] waitableResults)
{
return WaitAll(waitableResults, Timeout.Infinite, true);
}
@@ -1058,10 +994,7 @@ namespace Amib.Threading
///
/// true when every work item in workItemResults has completed; otherwise false.
///
- public static bool WaitAll(
- IWaitableResult[] waitableResults,
- TimeSpan timeout,
- bool exitContext)
+ public static bool WaitAll( IWaitableResult[] waitableResults, TimeSpan timeout, bool exitContext)
{
return WaitAll(waitableResults, (int)timeout.TotalMilliseconds, exitContext);
}
@@ -1078,11 +1011,8 @@ namespace Amib.Threading
///
/// true when every work item in workItemResults has completed; otherwise false.
///
- public static bool WaitAll(
- IWaitableResult[] waitableResults,
- TimeSpan timeout,
- bool exitContext,
- WaitHandle cancelWaitHandle)
+ public static bool WaitAll( IWaitableResult[] waitableResults, TimeSpan timeout,
+ bool exitContext, WaitHandle cancelWaitHandle)
{
return WaitAll(waitableResults, (int)timeout.TotalMilliseconds, exitContext, cancelWaitHandle);
}
@@ -1098,10 +1028,7 @@ namespace Amib.Threading
///
/// true when every work item in workItemResults has completed; otherwise false.
///
- public static bool WaitAll(
- IWaitableResult[] waitableResults,
- int millisecondsTimeout,
- bool exitContext)
+ public static bool WaitAll( IWaitableResult[] waitableResults, int millisecondsTimeout, bool exitContext)
{
return WorkItem.WaitAll(waitableResults, millisecondsTimeout, exitContext, null);
}
@@ -1118,11 +1045,8 @@ namespace Amib.Threading
///
/// true when every work item in workItemResults has completed; otherwise false.
///
- public static bool WaitAll(
- IWaitableResult[] waitableResults,
- int millisecondsTimeout,
- bool exitContext,
- WaitHandle cancelWaitHandle)
+ public static bool WaitAll( IWaitableResult[] waitableResults, int millisecondsTimeout,
+ bool exitContext, WaitHandle cancelWaitHandle)
{
return WorkItem.WaitAll(waitableResults, millisecondsTimeout, exitContext, cancelWaitHandle);
}
@@ -1135,8 +1059,7 @@ namespace Amib.Threading
///
/// The array index of the work item result that satisfied the wait, or WaitTimeout if any of the work items has been canceled.
///
- public static int WaitAny(
- IWaitableResult[] waitableResults)
+ public static int WaitAny( IWaitableResult[] waitableResults)
{
return WaitAny(waitableResults, Timeout.Infinite, true);
}
@@ -1152,10 +1075,7 @@ namespace Amib.Threading
///
/// The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled.
///
- public static int WaitAny(
- IWaitableResult[] waitableResults,
- TimeSpan timeout,
- bool exitContext)
+ public static int WaitAny( IWaitableResult[] waitableResults, TimeSpan timeout, bool exitContext)
{
return WaitAny(waitableResults, (int)timeout.TotalMilliseconds, exitContext);
}
@@ -1172,11 +1092,8 @@ namespace Amib.Threading
///
/// The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled.
///
- public static int WaitAny(
- IWaitableResult[] waitableResults,
- TimeSpan timeout,
- bool exitContext,
- WaitHandle cancelWaitHandle)
+ public static int WaitAny( IWaitableResult[] waitableResults, TimeSpan timeout,
+ bool exitContext, WaitHandle cancelWaitHandle)
{
return WaitAny(waitableResults, (int)timeout.TotalMilliseconds, exitContext, cancelWaitHandle);
}
@@ -1192,10 +1109,7 @@ namespace Amib.Threading
///
/// The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled.
///
- public static int WaitAny(
- IWaitableResult[] waitableResults,
- int millisecondsTimeout,
- bool exitContext)
+ public static int WaitAny( IWaitableResult[] waitableResults, int millisecondsTimeout, bool exitContext)
{
return WorkItem.WaitAny(waitableResults, millisecondsTimeout, exitContext, null);
}
@@ -1212,11 +1126,8 @@ namespace Amib.Threading
///
/// The array index of the work item result that satisfied the wait, or WaitTimeout if no work item result satisfied the wait and a time interval equivalent to millisecondsTimeout has passed or the work item has been canceled.
///
- public static int WaitAny(
- IWaitableResult[] waitableResults,
- int millisecondsTimeout,
- bool exitContext,
- WaitHandle cancelWaitHandle)
+ public static int WaitAny( IWaitableResult[] waitableResults, int millisecondsTimeout,
+ bool exitContext, WaitHandle cancelWaitHandle)
{
return WorkItem.WaitAny(waitableResults, millisecondsTimeout, exitContext, cancelWaitHandle);
}
@@ -1323,8 +1234,6 @@ namespace Amib.Threading
}
}
-
-
#endregion
#region Properties
diff --git a/ThirdParty/SmartThreadPool/WorkItem.cs b/ThirdParty/SmartThreadPool/WorkItem.cs
index dd2d24f70d..3814ba9a0e 100644
--- a/ThirdParty/SmartThreadPool/WorkItem.cs
+++ b/ThirdParty/SmartThreadPool/WorkItem.cs
@@ -142,9 +142,6 @@ namespace Amib.Threading.Internal
#region Performance Counter fields
-
-
-
///
/// Stores how long the work item waited on the stp queue
///
@@ -468,10 +465,7 @@ namespace Amib.Threading.Internal
///
/// true when every work item in waitableResults has completed; otherwise false.
///
- internal static bool WaitAll(
- IWaitableResult[] waitableResults,
- int millisecondsTimeout,
- bool exitContext,
+ internal static bool WaitAll( IWaitableResult[] waitableResults, int millisecondsTimeout, bool exitContext,
WaitHandle cancelWaitHandle)
{
if (0 == waitableResults.Length)