本文整理汇总了C#中Resource.Release方法的典型用法代码示例。如果您正苦于以下问题:C# Resource.Release方法的具体用法?C# Resource.Release怎么用?C# Resource.Release使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resource
的用法示例。
在下文中一共展示了Resource.Release方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Transport
private IEnumerable<Event> Transport(Environment env, Resource crane, Request token, string caster)
{
env.Log("Crane transporting from caster {0} at {1}", caster, env.Now);
yield return env.TimeoutD(4);
crane.Release(token);
}
示例2: Benchmark3Proc
static IEnumerable<Event> Benchmark3Proc(Environment env, Resource resource)
{
while (true) {
var req = resource.Request();
yield return req;
yield return resource.Release(req);
perf++;
}
}
示例3: ReleaseResource
private static void ReleaseResource(Resource resource, bool releaseAsset)
{
if (resource.RelativePath.EndsWith(".shader", StringComparison.InvariantCultureIgnoreCase))
return;
if (m_whiteList.Contains(Utils.GetFileName(resource.RelativePath)))
return;
resource.Release(releaseAsset);
resource.IsDone = false;
resource.referenceCount = 0;
}
示例4: TestResourceReleaseAfterInterruptVictim
private IEnumerable<Event> TestResourceReleaseAfterInterruptVictim(Environment env, Resource res)
{
var req = res.Request();
yield return req;
Assert.IsFalse(req.IsOk);
Assert.IsTrue(env.ActiveProcess.HandleFault());
// Dont wait for the resource
res.Release(req);
Assert.AreEqual(new DateTime(2014, 4, 1), env.Now);
}
示例5: TestResourceContinueAfterInterruptWaitingVictim
private IEnumerable<Event> TestResourceContinueAfterInterruptWaitingVictim(Environment env, Resource res)
{
var req = res.Request();
yield return req;
Assert.IsFalse(req.IsOk);
env.ActiveProcess.HandleFault();
yield return env.Timeout(TimeSpan.FromSeconds(2));
yield return req;
res.Release(req);
Assert.AreEqual(new DateTime(2014, 4, 1, 0, 0, 2), env.Now);
}
示例6: TestResource
private IEnumerable<Event> TestResource(Environment env, string name, Resource resource,
Dictionary<string, DateTime> log)
{
var req = resource.Request();
yield return req;
Assert.AreEqual(1, resource.InUse);
yield return env.Timeout(TimeSpan.FromSeconds(1));
resource.Release(req);
log.Add(name, env.Now);
}
示例7: Pack
static IEnumerable<Event> Pack(Environment env, Resource packer, Request token)
{
yield return env.TimeoutNormalPositive(PackerProcTimeMu, PackerProcTimeSigma);
packer.Release(token);
}