本文整理汇总了C#中ThreadState.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# ThreadState.GetValue方法的具体用法?C# ThreadState.GetValue怎么用?C# ThreadState.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ThreadState
的用法示例。
在下文中一共展示了ThreadState.GetValue方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CanComplete
public override bool CanComplete(ThreadState threadState)
{
// TODO: (much later) support exception here
VMValue_objectinst vinst = (VMValue_objectinst)threadState.GetValue(obj);
if(vinst.HoldingLockThreadID != threadState.ThreadID)
throw new Exception("Calling pulse on a lock we don't possess");
return true;
}
示例2: Complete
public override void Complete(ThreadState threadState)
{
VMValue dest = threadState.GetValue(destValue);
VMValue src = threadState.GetValue(srcValue);
dest.CopyFrom(src);
dest.IsConcrete = true;
if(CheckerConfiguration.DoPrintExecution)
{
if(dest is VMValue_int32)
Console.Write("Committing load of value {0} ",((VMValue_int32)dest).Value);
else if(dest is VMValue_double)
Console.Write("Committing load of value {0} ",((VMValue_double)dest).Value);
else if(dest is VMValue_object)
Console.Write("Committing write of {0}", ((VMValue_object)dest).ClassType);
else
Console.Write("Committing write of non-displayable value");
Console.WriteLine(" from {0} in {1}", sourceInstruction, threadState.CurrentMethod.Name);
}
}
示例3: CanComplete
// A lock action can be completed if the lock is free
// or it is currently hold by the same thread
public override bool CanComplete(ThreadState threadState)
{
// A DelayedLock can only be completed if the object instance is not locked
// or it is already locked by this thread
VMValue_objectinst vinst = (VMValue_objectinst)threadState.GetValue(obj);
if((vinst.HoldingLockThreadID == threadState.ThreadID) ||
(vinst.HoldingLockThreadID == -1))
return true;
else
return false;
}
示例4: Complete
// In completion stage, the lock action will actually
// set the object's lock field to be locked by this thread
public override void Complete(ThreadState threadState)
{
VMValue_objectinst vinst = (VMValue_objectinst)threadState.GetValue(obj);
if(vinst.HoldingLockThreadID == -1)
{
vinst.HoldingLockThreadID = threadState.ThreadID;
vinst.HoldingLockCount = nTimes;
}
else
vinst.HoldingLockCount += nTimes;
if(CheckerConfiguration.DoPrintExecution)
{
Console.WriteLine("Commiting Lock in thread " + threadState.CurrentMethod.Name + " on " + obj);
}
}
示例5: Complete
public override void Complete(ThreadState threadState)
{
VMValue_objectinst vinst = (VMValue_objectinst)threadState.GetValue(obj);
if(vinst.HoldingLockThreadID == threadState.ThreadID)
{
vinst.HoldingLockCount--;
if(vinst.HoldingLockCount == 0)
vinst.HoldingLockThreadID = -1;
}
else
{
// If we unlock a lock that
// this thread does not possess, the instruction
// executes normally but has no effect
}
if(CheckerConfiguration.DoPrintExecution)
{
Console.WriteLine("Commiting Unlock in thread " + threadState.CurrentMethod.Name + " on " + obj);
}
}