size_t vio_write_pipe(Vio *vio, const uchar *buf, size_t count) { DWORD transferred; size_t ret= (size_t) -1; DBUG_ENTER("vio_write_pipe"); /* Attempt to write to the pipe (overlapped I/O). */ if (WriteFile(vio->hPipe, buf, count, &transferred, &vio->overlapped)) { /* The operation completed immediately. */ ret= transferred; } /* Write operation is pending completion asynchronously? */ else if (GetLastError() == ERROR_IO_PENDING) ret= wait_overlapped_result(vio, vio->write_timeout); DBUG_RETURN(ret); }
size_t vio_read_pipe(Vio *vio, uchar *buf, size_t count) { DWORD transferred; size_t ret= (size_t) -1; DBUG_ENTER("vio_read_pipe"); disable_iocp_notification(&vio->pipe_overlapped); /* Attempt to read from the pipe (overlapped I/O). */ if (ReadFile(vio->hPipe, buf, count, &transferred, &vio->overlapped)) { /* The operation completed immediately. */ ret= transferred; } /* Read operation is pending completion asynchronously? */ else if (GetLastError() == ERROR_IO_PENDING) ret= wait_overlapped_result(vio, vio->read_timeout); enable_iocp_notification(&vio->pipe_overlapped); DBUG_RETURN(ret); }