예제 #1
0
        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
0
        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);
        }