[Box Backup-dev] COMMIT r476 - box/chris/general/bin/bbackupd

Charles Lecklider boxbackup-dev@fluffy.co.uk
Mon, 20 Feb 2006 12:16:25 +0000


Ben Summers wrote:
> Maybe I'm wrong in thinking that you can wait on pipes.

You can. If you want to wait using the handle as the event you need to
be careful you don't try to read and write at the same time (since you
won't be able to tell which happened), but if you create an event for
the OVERLAPPED you're fine.


Something like this is certainly necessary, but I think this is the
wrong design. Having an extra thread just to talk to the command socket
is incredibly wasteful. With overlapped IO you can do all the IO on a
single thread with no blocking - but not like this.

Chris: If you're intent on learning overlapped IO you want to be looking
at completion ports. They're essentially a message queue, but without
all that tedious messing around with critical sections etc. You can wait
on them from multiple threads, and the wait has a timeout (which is what
I was planning on using for SSL keepalives - if no completion packet
comes in after X ms send the keepalive - no timer required).

However, once you start looking at it you'll soon realise that there's a
lot more that needs to change in order to take advantage of completion
ports properly. The good news is that none of the actual box code needs
to change (or at least I didn't see any in my quick review), and the new
code will be simpler in a lot of ways than the old, but the bad news is
that pretty much the entire Win32 architecture needs to change.

That's why I wasn't planning on working on it until 0.10 is done - start
adding this now and there'll never be a release....

-C