当前位置: 首页>>代码示例>>C#>>正文


C# ThreadState.GetValue方法代码示例

本文整理汇总了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;
        }
开发者ID:edwardt,项目名称:study,代码行数:9,代码来源:DelayedPulse.cs

示例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);
     }
 }
开发者ID:edwardt,项目名称:study,代码行数:19,代码来源:DelayedRead.cs

示例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;
 }
开发者ID:edwardt,项目名称:study,代码行数:13,代码来源:DelayedLock.cs

示例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);
     }
 }
开发者ID:edwardt,项目名称:study,代码行数:17,代码来源:DelayedLock.cs

示例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);
     }
 }
开发者ID:edwardt,项目名称:study,代码行数:20,代码来源:DelayedUnlock.cs


注:本文中的ThreadState.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。