本文整理汇总了C#中System.Thread.ReturnFromCompletion方法的典型用法代码示例。如果您正苦于以下问题:C# Thread.ReturnFromCompletion方法的具体用法?C# Thread.ReturnFromCompletion怎么用?C# Thread.ReturnFromCompletion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Thread
的用法示例。
在下文中一共展示了Thread.ReturnFromCompletion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: HandleWriteAsync
private static void HandleWriteAsync(Thread current, IOCompletion iocp, int retval, int new_pos)
{
if (retval < 0)
{
iocp.Dispose();
current.ReturnFromCompletion(retval);
return;
}
if (iocp.posToUpdate != null)
{
var inode = iocp.posToUpdate.inode;
iocp.posToUpdate.position = (uint)new_pos;
// If position went beyond size, update size.
if (new_pos > inode.Size)
inode.Size = (uint)new_pos;
}
iocp.Dispose();
current.ReturnFromCompletion(retval);
}
示例2: HandleReadAsync
private static void HandleReadAsync(Thread current, IOCompletion iocp, int retval, int new_pos)
{
if (retval < 0)
{
iocp.Dispose();
current.ReturnFromCompletion(retval);
return;
}
var notWritten = iocp.userBuf.Write(current, new Pointer(iocp.buf.Location), retval);
if (iocp.posToUpdate != null)
{
iocp.posToUpdate.position = (uint)(new_pos - notWritten);
}
iocp.Dispose();
current.ReturnFromCompletion(retval);
}