C++ Refactor asynch level to enable easier Windows porting
----------------------------------------------------------

                 Key: QPID-1377
                 URL: https://issues.apache.org/jira/browse/QPID-1377
             Project: Qpid
          Issue Type: Improvement
          Components: C++ Broker, C++ Client
            Reporter: Steve Huston
            Assignee: Steve Huston
         Attachments: aio.diff

This issue is in preparation for the rest of the Windows porting. It's by 
itself because it deals with refactoring/splitting some of the existing 
qpid/sys modules to better prepare for adding the Windows code. Most of these 
ideas have been reviewed a few times by Andrew Stitcher in the past, though 
some of the AsynchIO splitting is new (I'll explain why below).

Here's the high level overview:

- Poller::Direction names IN and OUT change to INPUT and OUTPUT to avoid 
clashing with Windows-defined macros. Yucky, but that's life.
- DispatcHandle - split out of Dispatcher.h, .cpp to new files 
DispatchHandle.h, .cpp - makes it easier to reuse Dispatcher for Windows; 
DispatchHandle is not needed.
- qpid::sys::AsynchIO turns into a pure virtual interface class; platforms 
derive from it and whatever else they need to implement correctly for the 
platform. This is for two reasons:
    1. The previous approach discussed was to basically redefine/implement 
AsynchIO as needed in Windows, then for every place where AsynchIO is used, 
clone the file and edit to use Windows. This was working ok, but recently a 
number of changes were made to the cloned-and-copied sources and it became 
clear that the copy-and-edit approach was going to cause me way too many 
headaches to deal with over time.
    2. Uses of AsynchIO are in client and broker code where there are dynamic 
allocations, but AsynchIO implementation, as well as its deletions, are in 
common. As these are split into actual DLLs, having allocations and deletions 
in different DLLs will cause heap problems on Windows. So, since common does 
the deletes based on usage and outstanding operations, the allocations are now 
there in common as well. This is via a new qpid::sys::AsynchIO::create() static 
method. Each platform implements AsynchIO::create() as it needs; in particular, 
it allocates a platform-specific class derived from qpid::sys::AsynchIO which 
neatly hides all the platform messiness behind a virtual interface.

There's also some initial Windows code in the patch - you can ignore things in 
qpid/sys/windows unless you're really interested in the platform code - it's 
not related to the Linux code.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to