mirror of
https://github.com/opensim/opensim.git
synced 2026-08-09 02:36:00 +08:00
cosmetics
This commit is contained in:
16
ThirdParty/SmartThreadPool/SmartThreadPool.cs
vendored
16
ThirdParty/SmartThreadPool/SmartThreadPool.cs
vendored
@@ -826,6 +826,7 @@ namespace Amib.Threading
|
|||||||
InformCompleted();
|
InformCompleted();
|
||||||
FireOnThreadTermination();
|
FireOnThreadTermination();
|
||||||
_workItemsQueue.CloseThreadWaiter();
|
_workItemsQueue.CloseThreadWaiter();
|
||||||
|
CurrentThreadEntry = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -860,19 +861,8 @@ namespace Amib.Threading
|
|||||||
|
|
||||||
internal static void ValidateWorkItemsGroupWaitForIdle(IWorkItemsGroup workItemsGroup)
|
internal static void ValidateWorkItemsGroupWaitForIdle(IWorkItemsGroup workItemsGroup)
|
||||||
{
|
{
|
||||||
if (null == CurrentThreadEntry)
|
if (CurrentThreadEntry != null)
|
||||||
{
|
ValidateWorkItemsGroupWaitForIdleImpl(workItemsGroup, CurrentThreadEntry.CurrentWorkItem);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
WorkItem workItem = CurrentThreadEntry.CurrentWorkItem;
|
|
||||||
ValidateWorkItemsGroupWaitForIdleImpl(workItemsGroup, workItem);
|
|
||||||
if ((null != workItemsGroup) &&
|
|
||||||
(null != workItem) &&
|
|
||||||
CurrentThreadEntry.CurrentWorkItem.WasQueuedBy(workItemsGroup))
|
|
||||||
{
|
|
||||||
throw new NotSupportedException("WaitForIdle cannot be called from a thread on its SmartThreadPool, it causes a deadlock");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[MethodImpl(MethodImplOptions.NoInlining)]
|
[MethodImpl(MethodImplOptions.NoInlining)]
|
||||||
|
|||||||
23
ThirdParty/SmartThreadPool/WorkItem.cs
vendored
23
ThirdParty/SmartThreadPool/WorkItem.cs
vendored
@@ -248,10 +248,7 @@ namespace Amib.Threading.Internal
|
|||||||
_workItemCompletedRefCount = 0;
|
_workItemCompletedRefCount = 0;
|
||||||
_waitingOnQueueStopwatch = new Stopwatch();
|
_waitingOnQueueStopwatch = new Stopwatch();
|
||||||
_processingStopwatch = new Stopwatch();
|
_processingStopwatch = new Stopwatch();
|
||||||
_expirationTime =
|
_expirationTime = _workItemInfo.Timeout > 0 ? DateTime.UtcNow.Ticks + _workItemInfo.Timeout * TimeSpan.TicksPerMillisecond : long.MaxValue;
|
||||||
_workItemInfo.Timeout > 0 ?
|
|
||||||
DateTime.UtcNow.Ticks + _workItemInfo.Timeout * TimeSpan.TicksPerMillisecond :
|
|
||||||
long.MaxValue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
internal bool WasQueuedBy(IWorkItemsGroup workItemsGroup)
|
internal bool WasQueuedBy(IWorkItemsGroup workItemsGroup)
|
||||||
@@ -653,24 +650,18 @@ namespace Amib.Threading.Internal
|
|||||||
{
|
{
|
||||||
return _workItemState;
|
return _workItemState;
|
||||||
}
|
}
|
||||||
|
if (WorkItemState.Canceled != _workItemState && DateTime.UtcNow.Ticks > _expirationTime)
|
||||||
long nowTicks = DateTime.UtcNow.Ticks;
|
|
||||||
|
|
||||||
if (WorkItemState.Canceled != _workItemState && nowTicks > _expirationTime)
|
|
||||||
{
|
{
|
||||||
_workItemState = WorkItemState.Canceled;
|
_workItemState = WorkItemState.Canceled;
|
||||||
}
|
|
||||||
|
|
||||||
if (WorkItemState.InProgress == _workItemState)
|
|
||||||
{
|
|
||||||
return _workItemState;
|
return _workItemState;
|
||||||
}
|
}
|
||||||
|
if(WorkItemState.InProgress != _workItemState)
|
||||||
if (CanceledSmartThreadPool.IsCanceled || CanceledWorkItemsGroup.IsCanceled)
|
|
||||||
{
|
{
|
||||||
return WorkItemState.Canceled;
|
if (CanceledSmartThreadPool.IsCanceled || CanceledWorkItemsGroup.IsCanceled)
|
||||||
|
{
|
||||||
|
return WorkItemState.Canceled;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return _workItemState;
|
return _workItemState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user