From 48de8aca66cd6fa7626d9835d4a9b8711ef7454a Mon Sep 17 00:00:00 2001 From: Ami Bar Date: Thu, 24 Dec 2009 01:39:59 +0200 Subject: [PATCH] Changed build macros SILVERLIGHT changed to _SILVERLIGHT WindowsCE changed to _WINDOWS_CE _MONO was added --- STPSLDemo/STPSLDemo.csproj | 2 +- SmartThreadPool/CallerThreadContext.cs | 2 +- SmartThreadPool/EventWaitHandle.cs | 2 +- SmartThreadPool/EventWaitHandleFactory.cs | 8 ++++---- SmartThreadPool/Exceptions.cs | 4 ++-- SmartThreadPool/SLExt.cs | 2 +- SmartThreadPool/STPEventWaitHandle.cs | 2 +- SmartThreadPool/STPPerformanceCounter.cs | 2 +- SmartThreadPool/SmartThreadPool.cs | 14 +++++++------- SmartThreadPool/SmartThreadPoolCE.csproj | 4 ++-- SmartThreadPool/SmartThreadPoolMono.csproj | 4 ++-- SmartThreadPool/SmartThreadPoolSL.csproj | 4 ++-- SmartThreadPool/WorkItem.cs | 12 ++++++------ SmartThreadPool/WorkItemsGroup.cs | 2 +- SmartThreadPool/WorkItemsQueue.cs | 4 ++-- 15 files changed, 34 insertions(+), 34 deletions(-) diff --git a/STPSLDemo/STPSLDemo.csproj b/STPSLDemo/STPSLDemo.csproj index db7e8cf..94db809 100644 --- a/STPSLDemo/STPSLDemo.csproj +++ b/STPSLDemo/STPSLDemo.csproj @@ -44,7 +44,7 @@ pdbonly true Bin\Release - TRACE;SILVERLIGHT + TRACE;SILVERLIGHT=1 true true prompt diff --git a/SmartThreadPool/CallerThreadContext.cs b/SmartThreadPool/CallerThreadContext.cs index e111a65..92ea771 100644 --- a/SmartThreadPool/CallerThreadContext.cs +++ b/SmartThreadPool/CallerThreadContext.cs @@ -1,5 +1,5 @@ -#if !(WindowsCE) && !(SILVERLIGHT) +#if !(_WINDOWS_CE) && !(_SILVERLIGHT) using System; using System.Diagnostics; diff --git a/SmartThreadPool/EventWaitHandle.cs b/SmartThreadPool/EventWaitHandle.cs index 178501d..25be07a 100644 --- a/SmartThreadPool/EventWaitHandle.cs +++ b/SmartThreadPool/EventWaitHandle.cs @@ -1,4 +1,4 @@ -#if (WindowsCE) +#if (_WINDOWS_CE) using System; using System.Runtime.InteropServices; diff --git a/SmartThreadPool/EventWaitHandleFactory.cs b/SmartThreadPool/EventWaitHandleFactory.cs index 42d214e..3c9c849 100644 --- a/SmartThreadPool/EventWaitHandleFactory.cs +++ b/SmartThreadPool/EventWaitHandleFactory.cs @@ -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) /// /// Replace the event handle diff --git a/SmartThreadPool/Exceptions.cs b/SmartThreadPool/Exceptions.cs index 45a481f..1125b54 100644 --- a/SmartThreadPool/Exceptions.cs +++ b/SmartThreadPool/Exceptions.cs @@ -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) /// /// Represents an exception in case IWorkItemResult.GetResult has been canceled /// diff --git a/SmartThreadPool/SLExt.cs b/SmartThreadPool/SLExt.cs index 038daf3..0b894c8 100644 --- a/SmartThreadPool/SLExt.cs +++ b/SmartThreadPool/SLExt.cs @@ -1,4 +1,4 @@ -#if SILVERLIGHT +#if _SILVERLIGHT using System.Threading; diff --git a/SmartThreadPool/STPEventWaitHandle.cs b/SmartThreadPool/STPEventWaitHandle.cs index 02f7e0e..33936d2 100644 --- a/SmartThreadPool/STPEventWaitHandle.cs +++ b/SmartThreadPool/STPEventWaitHandle.cs @@ -1,4 +1,4 @@ -#if !(WindowsCE) +#if !(_WINDOWS_CE) using System; using System.Threading; diff --git a/SmartThreadPool/STPPerformanceCounter.cs b/SmartThreadPool/STPPerformanceCounter.cs index 263c586..52ab742 100644 --- a/SmartThreadPool/STPPerformanceCounter.cs +++ b/SmartThreadPool/STPPerformanceCounter.cs @@ -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 { diff --git a/SmartThreadPool/SmartThreadPool.cs b/SmartThreadPool/SmartThreadPool.cs index fbae208..58f5e2a 100644 --- a/SmartThreadPool/SmartThreadPool.cs +++ b/SmartThreadPool/SmartThreadPool.cs @@ -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 /// 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 ) diff --git a/SmartThreadPool/SmartThreadPoolCE.csproj b/SmartThreadPool/SmartThreadPoolCE.csproj index 4ca0771..10203f3 100644 --- a/SmartThreadPool/SmartThreadPoolCE.csproj +++ b/SmartThreadPool/SmartThreadPoolCE.csproj @@ -32,7 +32,7 @@ full false bin\Debug\ - TRACE;DEBUG;WindowsCE,_WINDOWS + TRACE;DEBUG;_WINDOWS_CE,_WINDOWS true true prompt @@ -44,7 +44,7 @@ pdbonly true bin\Release\ - TRACE;WindowsCE,_WINDOWS + TRACE;_WINDOWS_CE,_WINDOWS true true prompt diff --git a/SmartThreadPool/SmartThreadPoolMono.csproj b/SmartThreadPool/SmartThreadPoolMono.csproj index c5f7e37..ce4c31f 100644 --- a/SmartThreadPool/SmartThreadPoolMono.csproj +++ b/SmartThreadPool/SmartThreadPoolMono.csproj @@ -18,7 +18,7 @@ full false .\bin\Debug\ - TRACE;DEBUG;NO_WINDOWS + TRACE;DEBUG;_MONO @@ -26,7 +26,7 @@ pdbonly true .\bin\Release\ - TRACE;NO_WINDOWS + TRACE;_MONO diff --git a/SmartThreadPool/SmartThreadPoolSL.csproj b/SmartThreadPool/SmartThreadPoolSL.csproj index abbf75c..76f1fcb 100644 --- a/SmartThreadPool/SmartThreadPoolSL.csproj +++ b/SmartThreadPool/SmartThreadPoolSL.csproj @@ -25,7 +25,7 @@ full false Bin\Debug - TRACE;DEBUG;SILVERLIGHT,_WINDOWS + TRACE;DEBUG;_SILVERLIGHT,_WINDOWS true true prompt @@ -35,7 +35,7 @@ pdbonly true Bin\Release - TRACE;SILVERLIGHT,_WINDOWS + TRACE;_SILVERLIGHT,_WINDOWS true true prompt diff --git a/SmartThreadPool/WorkItem.cs b/SmartThreadPool/WorkItem.cs index 5d0e221..1641691 100644 --- a/SmartThreadPool/WorkItem.cs +++ b/SmartThreadPool/WorkItem.cs @@ -61,7 +61,7 @@ namespace Amib.Threading.Internal /// private object _state; -#if !(WindowsCE) && !(SILVERLIGHT) +#if !(_WINDOWS_CE) && !(_SILVERLIGHT) /// /// Stores the caller's context /// @@ -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 true on success or false if the work item is in progress or already completed private bool Cancel(bool abortExecution) { -#if (WindowsCE) +#if (_WINDOWS_CE) if(abortExecution) { throw new ArgumentOutOfRangeException("abortExecution", "WindowsCE doesn't support this feature"); diff --git a/SmartThreadPool/WorkItemsGroup.cs b/SmartThreadPool/WorkItemsGroup.cs index d5bec6b..d8b133b 100644 --- a/SmartThreadPool/WorkItemsGroup.cs +++ b/SmartThreadPool/WorkItemsGroup.cs @@ -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"); diff --git a/SmartThreadPool/WorkItemsQueue.cs b/SmartThreadPool/WorkItemsQueue.cs index d948ddb..e7e265a 100644 --- a/SmartThreadPool/WorkItemsQueue.cs +++ b/SmartThreadPool/WorkItemsQueue.cs @@ -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 /// private static WaiterEntry CurrentWaiterEntry { -#if (WindowsCE) +#if (_WINDOWS_CE) get { return Thread.GetData(_waiterEntrySlot) as WaiterEntry;