コード例 #1
0
ファイル: SmartThreadPool.cs プロジェクト: dengliyan/XUtils
        internal static void ValidateWorkItemsGroupWaitForIdle(IWorkItemsGroup workItemsGroup)
        {
            if (SmartThreadPool.CurrentThreadEntry == null)
            {
                return;
            }
            WorkItem currentWorkItem = SmartThreadPool.CurrentThreadEntry.CurrentWorkItem;

            SmartThreadPool.ValidateWorkItemsGroupWaitForIdleImpl(workItemsGroup, currentWorkItem);
            if (workItemsGroup != null && currentWorkItem != null && SmartThreadPool.CurrentThreadEntry.CurrentWorkItem.WasQueuedBy(workItemsGroup))
            {
                throw new NotSupportedException("WaitForIdle cannot be called from a thread on its SmartThreadPool, it causes a deadlock");
            }
        }
コード例 #2
0
ファイル: SmartThreadPool.cs プロジェクト: dengliyan/XUtils
 public static int WaitAny(IWaitableResult[] waitableResults, TimeSpan timeout, bool exitContext, WaitHandle cancelWaitHandle)
 {
     return(SmartThreadPool.WaitAny(waitableResults, (int)timeout.TotalMilliseconds, exitContext, cancelWaitHandle));
 }
コード例 #3
0
ファイル: SmartThreadPool.cs プロジェクト: dengliyan/XUtils
 public static int WaitAny(IWaitableResult[] waitableResults)
 {
     return(SmartThreadPool.WaitAny(waitableResults, -1, true));
 }
コード例 #4
0
ファイル: SmartThreadPool.cs プロジェクト: dengliyan/XUtils
 public static bool WaitAll(IWaitableResult[] waitableResults, TimeSpan timeout, bool exitContext)
 {
     return(SmartThreadPool.WaitAll(waitableResults, (int)timeout.TotalMilliseconds, exitContext));
 }
コード例 #5
0
ファイル: SmartThreadPool.cs プロジェクト: dengliyan/XUtils
 public static bool WaitAll(IWaitableResult[] waitableResults)
 {
     return(SmartThreadPool.WaitAll(waitableResults, -1, true));
 }
コード例 #6
0
ファイル: SmartThreadPool.cs プロジェクト: dengliyan/XUtils
 public ThreadEntry(SmartThreadPool stp)
 {
     this._associatedSmartThreadPool = stp;
     this._creationTime  = DateTime.UtcNow;
     this._lastAliveTime = DateTime.MinValue;
 }