本文整理匯總了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);
}