[Box Backup-commit] Re: #3: Merge Win32 branch
Chris Wilson
chris at qwirx.com
Sun Mar 25 23:51:01 BST 2007
Hi Charles,
On Sun, 25 Mar 2007, trac at fluffy.co.uk wrote:
> [1486] I don't know if I can do this, but I'm going to try :-)
>
> I'd like to veto this change. You seem to have done a partial re-
> implementation of a completion port - see CreateIoCompletionPort and
> friends.
Thanks for the suggestion, but I'm afraid that after reading the
CreateIoCompletionPort docs I'm still not completely sure how I could use
it to replace [1486].
So far, what I understand (I think) is that the command socket thread,
instead of calling WaitForMultipleObjects, would call
GetQueuedCompletionStatus, which blocks until either (i) the main thread
posts a message to the port with PostQueuedCompletionStatus, or (ii) a
packet is received over the command socket by the pending overlapped I/O.
Is that correct?
What bothers me is that MSDN says "After an instance of an open file is
associated with an I/O completion port, it cannot be used in the
ReadFileEx or WriteFileEx function."
I assume that this means that I have to use overlapped I/O for both
reading and writing from the pipe? I don't care about completion of
writes, although I suppose I could dispatch the next waiting message (if
any) to the pipe in this case.
And how do I actually read or write on the pipe, if ReadFileEx and
WriteFileEx are forbidden? Do good old ReadFile and WriteFile work
properly?
I have a feeling that implementing this will move the WinNamedPipeStream
API so far away from POSIX that I will have to create a new class that
doesn't extend IOStream for this purpose. While it might be a cleaner
solution to the current overlapped/nonoverlapped read branches in the
code, I'm worried about the duplication of code and possible maintenance
headaches.
Are there any samples of using CreateIoCompletionPort and
PostQueuedCompletionStatus that I can freely copy and adapt for use in
this case?
--
_____ __ _
\ __/ / ,__(_)_ | Chris Wilson <0000 at qwirx.com> - Cambs UK |
/ (_/ ,\/ _/ /_ \ | Security/C/C++/Java/Perl/SQL/HTML Developer |
\ _/_/_/_//_/___/ | We are GNU-free your mind-and your software |
More information about the Boxbackup-commit
mailing list