mirror of
https://github.com/farcasclaudiu/SmartThreadPool.git
synced 2026-06-22 09:01:19 +03:00
Changed build macros
SILVERLIGHT changed to _SILVERLIGHT WindowsCE changed to _WINDOWS_CE _MONO was added
This commit is contained in:
@@ -44,7 +44,7 @@
|
|||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>Bin\Release</OutputPath>
|
<OutputPath>Bin\Release</OutputPath>
|
||||||
<DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
|
<DefineConstants>TRACE;SILVERLIGHT=1</DefineConstants>
|
||||||
<NoStdLib>true</NoStdLib>
|
<NoStdLib>true</NoStdLib>
|
||||||
<NoConfig>true</NoConfig>
|
<NoConfig>true</NoConfig>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
|
|
||||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#if (WindowsCE)
|
#if (_WINDOWS_CE)
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
#if (WindowsCE)
|
#if (_WINDOWS_CE)
|
||||||
using System;
|
using System;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
#endif
|
#endif
|
||||||
@@ -25,7 +25,7 @@ namespace Amib.Threading.Internal
|
|||||||
{
|
{
|
||||||
AutoResetEvent waitHandle = new AutoResetEvent(false);
|
AutoResetEvent waitHandle = new AutoResetEvent(false);
|
||||||
|
|
||||||
#if (WindowsCE)
|
#if (_WINDOWS_CE)
|
||||||
ReplaceEventHandle(waitHandle, false, false);
|
ReplaceEventHandle(waitHandle, false, false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -40,14 +40,14 @@ namespace Amib.Threading.Internal
|
|||||||
{
|
{
|
||||||
ManualResetEvent waitHandle = new ManualResetEvent(initialState);
|
ManualResetEvent waitHandle = new ManualResetEvent(initialState);
|
||||||
|
|
||||||
#if (WindowsCE)
|
#if (_WINDOWS_CE)
|
||||||
ReplaceEventHandle(waitHandle, true, initialState);
|
ReplaceEventHandle(waitHandle, true, initialState);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return waitHandle;
|
return waitHandle;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (WindowsCE)
|
#if (_WINDOWS_CE)
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Replace the event handle
|
/// Replace the event handle
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
#if !(WindowsCE)
|
#if !(_WINDOWS_CE)
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -68,7 +68,7 @@ namespace Amib.Threading
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents an exception in case IWorkItemResult.GetResult has been canceled
|
/// Represents an exception in case IWorkItemResult.GetResult has been canceled
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#if SILVERLIGHT
|
#if _SILVERLIGHT
|
||||||
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
#if !(WindowsCE)
|
#if !(_WINDOWS_CE)
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ namespace Amib.Threading.Internal
|
|||||||
void SampleWorkItemsWaitTime(TimeSpan workItemWaitTime);
|
void SampleWorkItemsWaitTime(TimeSpan workItemWaitTime);
|
||||||
void SampleWorkItemsProcessTime(TimeSpan workItemProcessTime);
|
void SampleWorkItemsProcessTime(TimeSpan workItemProcessTime);
|
||||||
}
|
}
|
||||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||||
|
|
||||||
internal enum STPPerformanceCounterType
|
internal enum STPPerformanceCounterType
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -265,7 +265,7 @@ namespace Amib.Threading
|
|||||||
private ISTPInstancePerformanceCounters _localPCs = NullSTPInstancePerformanceCounters.Instance;
|
private ISTPInstancePerformanceCounters _localPCs = NullSTPInstancePerformanceCounters.Instance;
|
||||||
|
|
||||||
|
|
||||||
#if (WindowsCE)
|
#if (_WINDOWS_CE)
|
||||||
private static LocalDataStoreSlot _threadEntrySlot = Thread.AllocateDataSlot();
|
private static LocalDataStoreSlot _threadEntrySlot = Thread.AllocateDataSlot();
|
||||||
#else
|
#else
|
||||||
[ThreadStatic]
|
[ThreadStatic]
|
||||||
@@ -295,7 +295,7 @@ namespace Amib.Threading
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal static ThreadEntry CurrentThreadEntry
|
internal static ThreadEntry CurrentThreadEntry
|
||||||
{
|
{
|
||||||
#if (WindowsCE)
|
#if (_WINDOWS_CE)
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Thread.GetData(_threadEntrySlot) as ThreadEntry;
|
return Thread.GetData(_threadEntrySlot) as ThreadEntry;
|
||||||
@@ -398,10 +398,10 @@ namespace Amib.Threading
|
|||||||
|
|
||||||
_isSuspended = _stpStartInfo.StartSuspended;
|
_isSuspended = _stpStartInfo.StartSuspended;
|
||||||
|
|
||||||
#if (WindowsCE) || (SILVERLIGHT)
|
#if (_WINDOWS_CE) || (_SILVERLIGHT) || (_MONO)
|
||||||
if (null != _stpStartInfo.PerformanceCounterInstanceName)
|
if (null != _stpStartInfo.PerformanceCounterInstanceName)
|
||||||
{
|
{
|
||||||
throw new NotSupportedException("Performance counters are not implemented for Compact Framework/Silverlight");
|
throw new NotSupportedException("Performance counters are not implemented for Compact Framework/Silverlight/Mono, instead use StpStartInfo.EnableLocalPerformanceCounters");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
if (null != _stpStartInfo.PerformanceCounterInstanceName)
|
if (null != _stpStartInfo.PerformanceCounterInstanceName)
|
||||||
@@ -609,7 +609,7 @@ namespace Amib.Threading
|
|||||||
// Configure the new thread and start it
|
// Configure the new thread and start it
|
||||||
workerThread.Name = "STP " + Name + " Thread #" + _threadCounter;
|
workerThread.Name = "STP " + Name + " Thread #" + _threadCounter;
|
||||||
workerThread.IsBackground = true;
|
workerThread.IsBackground = true;
|
||||||
#if !(SILVERLIGHT)
|
#if !(_SILVERLIGHT)
|
||||||
workerThread.Priority = _stpStartInfo.ThreadPriority;
|
workerThread.Priority = _stpStartInfo.ThreadPriority;
|
||||||
#endif
|
#endif
|
||||||
workerThread.Start();
|
workerThread.Start();
|
||||||
@@ -779,7 +779,7 @@ namespace Amib.Threading
|
|||||||
{
|
{
|
||||||
tae.GetHashCode();
|
tae.GetHashCode();
|
||||||
// Handle the abort exception gracfully.
|
// Handle the abort exception gracfully.
|
||||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||||
Thread.ResetAbort();
|
Thread.ResetAbort();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -939,7 +939,7 @@ namespace Amib.Threading
|
|||||||
{
|
{
|
||||||
|
|
||||||
if ((thread != null)
|
if ((thread != null)
|
||||||
#if !(WindowsCE)
|
#if !(_WINDOWS_CE)
|
||||||
&& thread.IsAlive
|
&& thread.IsAlive
|
||||||
#endif
|
#endif
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -32,7 +32,7 @@
|
|||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>bin\Debug\</OutputPath>
|
<OutputPath>bin\Debug\</OutputPath>
|
||||||
<DefineConstants>TRACE;DEBUG;WindowsCE,_WINDOWS</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;_WINDOWS_CE,_WINDOWS</DefineConstants>
|
||||||
<NoStdLib>true</NoStdLib>
|
<NoStdLib>true</NoStdLib>
|
||||||
<NoConfig>true</NoConfig>
|
<NoConfig>true</NoConfig>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
@@ -44,7 +44,7 @@
|
|||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>bin\Release\</OutputPath>
|
<OutputPath>bin\Release\</OutputPath>
|
||||||
<DefineConstants>TRACE;WindowsCE,_WINDOWS</DefineConstants>
|
<DefineConstants>TRACE;_WINDOWS_CE,_WINDOWS</DefineConstants>
|
||||||
<NoStdLib>true</NoStdLib>
|
<NoStdLib>true</NoStdLib>
|
||||||
<NoConfig>true</NoConfig>
|
<NoConfig>true</NoConfig>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>.\bin\Debug\</OutputPath>
|
<OutputPath>.\bin\Debug\</OutputPath>
|
||||||
<DefineConstants>TRACE;DEBUG;NO_WINDOWS</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;_MONO</DefineConstants>
|
||||||
<DocumentationFile>
|
<DocumentationFile>
|
||||||
</DocumentationFile>
|
</DocumentationFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
@@ -26,7 +26,7 @@
|
|||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>.\bin\Release\</OutputPath>
|
<OutputPath>.\bin\Release\</OutputPath>
|
||||||
<DefineConstants>TRACE;NO_WINDOWS</DefineConstants>
|
<DefineConstants>TRACE;_MONO</DefineConstants>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
|
|||||||
@@ -25,7 +25,7 @@
|
|||||||
<DebugType>full</DebugType>
|
<DebugType>full</DebugType>
|
||||||
<Optimize>false</Optimize>
|
<Optimize>false</Optimize>
|
||||||
<OutputPath>Bin\Debug</OutputPath>
|
<OutputPath>Bin\Debug</OutputPath>
|
||||||
<DefineConstants>TRACE;DEBUG;SILVERLIGHT,_WINDOWS</DefineConstants>
|
<DefineConstants>TRACE;DEBUG;_SILVERLIGHT,_WINDOWS</DefineConstants>
|
||||||
<NoStdLib>true</NoStdLib>
|
<NoStdLib>true</NoStdLib>
|
||||||
<NoConfig>true</NoConfig>
|
<NoConfig>true</NoConfig>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
<Optimize>true</Optimize>
|
<Optimize>true</Optimize>
|
||||||
<OutputPath>Bin\Release</OutputPath>
|
<OutputPath>Bin\Release</OutputPath>
|
||||||
<DefineConstants>TRACE;SILVERLIGHT,_WINDOWS</DefineConstants>
|
<DefineConstants>TRACE;_SILVERLIGHT,_WINDOWS</DefineConstants>
|
||||||
<NoStdLib>true</NoStdLib>
|
<NoStdLib>true</NoStdLib>
|
||||||
<NoConfig>true</NoConfig>
|
<NoConfig>true</NoConfig>
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
|
|||||||
@@ -61,7 +61,7 @@ namespace Amib.Threading.Internal
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private object _state;
|
private object _state;
|
||||||
|
|
||||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Stores the caller's context
|
/// Stores the caller's context
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -209,7 +209,7 @@ namespace Amib.Threading.Internal
|
|||||||
_workItemsGroup = workItemsGroup;
|
_workItemsGroup = workItemsGroup;
|
||||||
_workItemInfo = workItemInfo;
|
_workItemInfo = workItemInfo;
|
||||||
|
|
||||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||||
if (_workItemInfo.UseCallerCallContext || _workItemInfo.UseCallerHttpContext)
|
if (_workItemInfo.UseCallerCallContext || _workItemInfo.UseCallerHttpContext)
|
||||||
{
|
{
|
||||||
_callerContext = CallerThreadContext.Capture(_workItemInfo.UseCallerCallContext, _workItemInfo.UseCallerHttpContext);
|
_callerContext = CallerThreadContext.Capture(_workItemInfo.UseCallerCallContext, _workItemInfo.UseCallerHttpContext);
|
||||||
@@ -360,7 +360,7 @@ namespace Amib.Threading.Internal
|
|||||||
private void ExecuteWorkItem()
|
private void ExecuteWorkItem()
|
||||||
{
|
{
|
||||||
|
|
||||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||||
CallerThreadContext ctc = null;
|
CallerThreadContext ctc = null;
|
||||||
if (null != _callerContext)
|
if (null != _callerContext)
|
||||||
{
|
{
|
||||||
@@ -405,13 +405,13 @@ namespace Amib.Threading.Internal
|
|||||||
// work items was cancelled.
|
// work items was cancelled.
|
||||||
if (!SmartThreadPool.CurrentThreadEntry.AssociatedSmartThreadPool.IsShuttingdown)
|
if (!SmartThreadPool.CurrentThreadEntry.AssociatedSmartThreadPool.IsShuttingdown)
|
||||||
{
|
{
|
||||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||||
Thread.ResetAbort();
|
Thread.ResetAbort();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||||
if (null != _callerContext)
|
if (null != _callerContext)
|
||||||
{
|
{
|
||||||
CallerThreadContext.Apply(ctc);
|
CallerThreadContext.Apply(ctc);
|
||||||
@@ -708,7 +708,7 @@ namespace Amib.Threading.Internal
|
|||||||
/// <returns>Returns true on success or false if the work item is in progress or already completed</returns>
|
/// <returns>Returns true on success or false if the work item is in progress or already completed</returns>
|
||||||
private bool Cancel(bool abortExecution)
|
private bool Cancel(bool abortExecution)
|
||||||
{
|
{
|
||||||
#if (WindowsCE)
|
#if (_WINDOWS_CE)
|
||||||
if(abortExecution)
|
if(abortExecution)
|
||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException("abortExecution", "WindowsCE doesn't support this feature");
|
throw new ArgumentOutOfRangeException("abortExecution", "WindowsCE doesn't support this feature");
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ namespace Amib.Threading.Internal
|
|||||||
{
|
{
|
||||||
throw new ArgumentOutOfRangeException(
|
throw new ArgumentOutOfRangeException(
|
||||||
"concurrency",
|
"concurrency",
|
||||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||||
concurrency,
|
concurrency,
|
||||||
#endif
|
#endif
|
||||||
"concurrency must be greater than zero");
|
"concurrency must be greater than zero");
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Amib.Threading.Internal
|
|||||||
private bool _isWorkItemsQueueActive = true;
|
private bool _isWorkItemsQueueActive = true;
|
||||||
|
|
||||||
|
|
||||||
#if (WindowsCE)
|
#if (_WINDOWS_CE)
|
||||||
private static LocalDataStoreSlot _waiterEntrySlot = Thread.AllocateDataSlot();
|
private static LocalDataStoreSlot _waiterEntrySlot = Thread.AllocateDataSlot();
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ namespace Amib.Threading.Internal
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private static WaiterEntry CurrentWaiterEntry
|
private static WaiterEntry CurrentWaiterEntry
|
||||||
{
|
{
|
||||||
#if (WindowsCE)
|
#if (_WINDOWS_CE)
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return Thread.GetData(_waiterEntrySlot) as WaiterEntry;
|
return Thread.GetData(_waiterEntrySlot) as WaiterEntry;
|
||||||
|
|||||||
Reference in New Issue
Block a user