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>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>Bin\Release</OutputPath>
|
||||
<DefineConstants>TRACE;SILVERLIGHT</DefineConstants>
|
||||
<DefineConstants>TRACE;SILVERLIGHT=1</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
||||
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if (WindowsCE)
|
||||
#if (_WINDOWS_CE)
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Threading;
|
||||
|
||||
#if (WindowsCE)
|
||||
#if (_WINDOWS_CE)
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
#endif
|
||||
@@ -25,7 +25,7 @@ namespace Amib.Threading.Internal
|
||||
{
|
||||
AutoResetEvent waitHandle = new AutoResetEvent(false);
|
||||
|
||||
#if (WindowsCE)
|
||||
#if (_WINDOWS_CE)
|
||||
ReplaceEventHandle(waitHandle, false, false);
|
||||
#endif
|
||||
|
||||
@@ -40,14 +40,14 @@ namespace Amib.Threading.Internal
|
||||
{
|
||||
ManualResetEvent waitHandle = new ManualResetEvent(initialState);
|
||||
|
||||
#if (WindowsCE)
|
||||
#if (_WINDOWS_CE)
|
||||
ReplaceEventHandle(waitHandle, true, initialState);
|
||||
#endif
|
||||
|
||||
return waitHandle;
|
||||
}
|
||||
|
||||
#if (WindowsCE)
|
||||
#if (_WINDOWS_CE)
|
||||
|
||||
/// <summary>
|
||||
/// Replace the event handle
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
#if !(WindowsCE)
|
||||
#if !(_WINDOWS_CE)
|
||||
using System.Runtime.Serialization;
|
||||
#endif
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace Amib.Threading
|
||||
}
|
||||
|
||||
|
||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
||||
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||
/// <summary>
|
||||
/// Represents an exception in case IWorkItemResult.GetResult has been canceled
|
||||
/// </summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if SILVERLIGHT
|
||||
#if _SILVERLIGHT
|
||||
|
||||
using System.Threading;
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#if !(WindowsCE)
|
||||
#if !(_WINDOWS_CE)
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace Amib.Threading.Internal
|
||||
void SampleWorkItemsWaitTime(TimeSpan workItemWaitTime);
|
||||
void SampleWorkItemsProcessTime(TimeSpan workItemProcessTime);
|
||||
}
|
||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
||||
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||
|
||||
internal enum STPPerformanceCounterType
|
||||
{
|
||||
|
||||
@@ -265,7 +265,7 @@ namespace Amib.Threading
|
||||
private ISTPInstancePerformanceCounters _localPCs = NullSTPInstancePerformanceCounters.Instance;
|
||||
|
||||
|
||||
#if (WindowsCE)
|
||||
#if (_WINDOWS_CE)
|
||||
private static LocalDataStoreSlot _threadEntrySlot = Thread.AllocateDataSlot();
|
||||
#else
|
||||
[ThreadStatic]
|
||||
@@ -295,7 +295,7 @@ namespace Amib.Threading
|
||||
/// </summary>
|
||||
internal static ThreadEntry CurrentThreadEntry
|
||||
{
|
||||
#if (WindowsCE)
|
||||
#if (_WINDOWS_CE)
|
||||
get
|
||||
{
|
||||
return Thread.GetData(_threadEntrySlot) as ThreadEntry;
|
||||
@@ -398,10 +398,10 @@ namespace Amib.Threading
|
||||
|
||||
_isSuspended = _stpStartInfo.StartSuspended;
|
||||
|
||||
#if (WindowsCE) || (SILVERLIGHT)
|
||||
#if (_WINDOWS_CE) || (_SILVERLIGHT) || (_MONO)
|
||||
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
|
||||
if (null != _stpStartInfo.PerformanceCounterInstanceName)
|
||||
@@ -609,7 +609,7 @@ namespace Amib.Threading
|
||||
// Configure the new thread and start it
|
||||
workerThread.Name = "STP " + Name + " Thread #" + _threadCounter;
|
||||
workerThread.IsBackground = true;
|
||||
#if !(SILVERLIGHT)
|
||||
#if !(_SILVERLIGHT)
|
||||
workerThread.Priority = _stpStartInfo.ThreadPriority;
|
||||
#endif
|
||||
workerThread.Start();
|
||||
@@ -779,7 +779,7 @@ namespace Amib.Threading
|
||||
{
|
||||
tae.GetHashCode();
|
||||
// Handle the abort exception gracfully.
|
||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
||||
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||
Thread.ResetAbort();
|
||||
#endif
|
||||
}
|
||||
@@ -939,7 +939,7 @@ namespace Amib.Threading
|
||||
{
|
||||
|
||||
if ((thread != null)
|
||||
#if !(WindowsCE)
|
||||
#if !(_WINDOWS_CE)
|
||||
&& thread.IsAlive
|
||||
#endif
|
||||
)
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;WindowsCE,_WINDOWS</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;_WINDOWS_CE,_WINDOWS</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
@@ -44,7 +44,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;WindowsCE,_WINDOWS</DefineConstants>
|
||||
<DefineConstants>TRACE;_WINDOWS_CE,_WINDOWS</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>.\bin\Debug\</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;NO_WINDOWS</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;_MONO</DefineConstants>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
</PropertyGroup>
|
||||
@@ -26,7 +26,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>.\bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE;NO_WINDOWS</DefineConstants>
|
||||
<DefineConstants>TRACE;_MONO</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>Bin\Debug</OutputPath>
|
||||
<DefineConstants>TRACE;DEBUG;SILVERLIGHT,_WINDOWS</DefineConstants>
|
||||
<DefineConstants>TRACE;DEBUG;_SILVERLIGHT,_WINDOWS</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
@@ -35,7 +35,7 @@
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>Bin\Release</OutputPath>
|
||||
<DefineConstants>TRACE;SILVERLIGHT,_WINDOWS</DefineConstants>
|
||||
<DefineConstants>TRACE;_SILVERLIGHT,_WINDOWS</DefineConstants>
|
||||
<NoStdLib>true</NoStdLib>
|
||||
<NoConfig>true</NoConfig>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace Amib.Threading.Internal
|
||||
/// </summary>
|
||||
private object _state;
|
||||
|
||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
||||
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||
/// <summary>
|
||||
/// Stores the caller's context
|
||||
/// </summary>
|
||||
@@ -209,7 +209,7 @@ namespace Amib.Threading.Internal
|
||||
_workItemsGroup = workItemsGroup;
|
||||
_workItemInfo = workItemInfo;
|
||||
|
||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
||||
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||
if (_workItemInfo.UseCallerCallContext || _workItemInfo.UseCallerHttpContext)
|
||||
{
|
||||
_callerContext = CallerThreadContext.Capture(_workItemInfo.UseCallerCallContext, _workItemInfo.UseCallerHttpContext);
|
||||
@@ -360,7 +360,7 @@ namespace Amib.Threading.Internal
|
||||
private void ExecuteWorkItem()
|
||||
{
|
||||
|
||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
||||
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||
CallerThreadContext ctc = null;
|
||||
if (null != _callerContext)
|
||||
{
|
||||
@@ -405,13 +405,13 @@ namespace Amib.Threading.Internal
|
||||
// work items was cancelled.
|
||||
if (!SmartThreadPool.CurrentThreadEntry.AssociatedSmartThreadPool.IsShuttingdown)
|
||||
{
|
||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
||||
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||
Thread.ResetAbort();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
||||
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||
if (null != _callerContext)
|
||||
{
|
||||
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>
|
||||
private bool Cancel(bool abortExecution)
|
||||
{
|
||||
#if (WindowsCE)
|
||||
#if (_WINDOWS_CE)
|
||||
if(abortExecution)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("abortExecution", "WindowsCE doesn't support this feature");
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace Amib.Threading.Internal
|
||||
{
|
||||
throw new ArgumentOutOfRangeException(
|
||||
"concurrency",
|
||||
#if !(WindowsCE) && !(SILVERLIGHT)
|
||||
#if !(_WINDOWS_CE) && !(_SILVERLIGHT)
|
||||
concurrency,
|
||||
#endif
|
||||
"concurrency must be greater than zero");
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Amib.Threading.Internal
|
||||
private bool _isWorkItemsQueueActive = true;
|
||||
|
||||
|
||||
#if (WindowsCE)
|
||||
#if (_WINDOWS_CE)
|
||||
private static LocalDataStoreSlot _waiterEntrySlot = Thread.AllocateDataSlot();
|
||||
#else
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Amib.Threading.Internal
|
||||
/// </summary>
|
||||
private static WaiterEntry CurrentWaiterEntry
|
||||
{
|
||||
#if (WindowsCE)
|
||||
#if (_WINDOWS_CE)
|
||||
get
|
||||
{
|
||||
return Thread.GetData(_waiterEntrySlot) as WaiterEntry;
|
||||
|
||||
Reference in New Issue
Block a user