.net 4.0线程池异常

时间:2012-06-06 14:27:43

标签: c# exception threadpool queueuserworkitem

以下代码在使用.net 4.0编译时抛出以下异常,同时符合.net 2.0,没关系,任何人遇到我?,请帮助(我没有在回调函数中使用DateTime)。< / p>

public void ProcessPriceUpdate()
{
    Interlocked.Increment(ref this.counts);

    lock (contractLock)
    {
        ThreadPool.QueueUserWorkItem(priceCallback, null);
    }
}


>System.ArgumentOutOfRangeException was unhandled
>Message=Value to add was out of range.
>Parameter name: value
>Source=mscorlib
>ParamName=value
>StackTrace:
>at System.DateTime.Add(Double value, Int32 scale)
>at System.Threading.PlatformHelper.get_ProcessorCount()
>at System.Threading.SpinWait.SpinOnce()
>at System.Threading.ThreadPoolWorkQueue.QueueSegment.TryDequeue(IThreadPoolWorkItem& node)
>at System.Threading.ThreadPoolWorkQueue.Dequeue(ThreadPoolWorkQueueThreadLocals tl, IThreadPoolWorkItem& callback, Boolean& missedSteal)
>at System.Threading.ThreadPoolWorkQueue.Dispatch()
>at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback()
>InnerException:

0 个答案:

没有答案