![]() |
![]() |
Welcome to the September 2004 edition of Riverace's ACE News and Tips newsletter. This issue contains a tip for ensuring complete cleanup of an ACE_Svc_Handler-derived service instance, news about what's coming up in the next ACE release, and a note about our redesigned web site. Please forward this newsletter to anyone you think may be interested! Anyone who wishes to receive their own copy of this newsletter can subscribe at http://www.riverace.com/subscribe2/index.mv. If you no longer wish to subscribe, removal directions are at the bottom of this page. Please reply with any feedback you have on this newsletter, as well as ideas for information you'd like to see in upcoming newsletters. We want to be as helpful as possible, so please let us know how we can do that. Tip: Use the Default Behavior When Closing an ACE_Svc_HandlerLast month we looked at a tip for using the default behavior provided by the ACE_Svc_Handler::open() hook method. It's very useful because it does everything a service needs to do to get going (in most cases): register the new handler for input events and return. The default behavior of the shutdown sequence in ACE_Svc_Handler is applicable to even more situations than the initialization code in open(). This is because the hooks involved in both reactive shutdown and active-object shutdown cooperate to the same effect: removing any reactor registrations and insuring that the ACE_Svc_Handler-derived object is removed:
Therefore, regardless of whether the ACE_Svc_Handler object is reactive or active, cleanup processing ends up in the same place: ACE_Svc_Handler::destroy(). destroy() will delete the object if it was dynamically allocated and not part of a module in the ACE Streams framework. If the object was not dynamically allocated, its destruction is the responsibility of the enclosing scope, and if the object is part of a module in an ACE_Stream, the stream and/or the code controlling the stream is responsible for managing the lifetime of the object. destroy() enforces the policy and prevents resource leaks. Whether the ACE_Svc_Handler object is destroyed directly in destroy() or later, the same thing happens: ~ACE_Svc_Handler calls ACE_Svc_Handler::shutdown() to complete the cleanup of the service handler. shutdown() performs these cleanup operations:
So, we see that the vast majority of what usually needs cleaning up upon shutdown of a service handler is handled by the framework, simply by allowing the default hooks to execute. If your application requires some further specialized shutdown/cleanup processing, the recommended location for it is usually in your handler's handle_close() hook method. Just be sure to call ACE_Svc_Handler::destroy() as the last action in your handle_close() method to incorporate the rest of the framework's cleanup behavior. For more information on cleaning up an ACE_Svc_Handler, see APG section 7.6. In particular, Figure 7.3 on page 176 has a UML diagram depicting the interactions we looked at here. Additionally, C++NPv2 section 7.2 has lots of background information and an expanded discussion of shutdown processing, as well as a description (Sidebar 48 on page 212) of how ACE_Svc_Handler::destroy() knows whether or not the object was dynamically allocated. ACE.next: What's New?The ACE development community is hard at work on the next version of ACE. Here are some of the things you can look forward to (items in bold are new since last month):
New Web Site: www.riverace.com RelaunchedThe Riverace Corporation web site (http://www.riverace.com/) has been redesigned and redeployed. The goals were to make the site easier to navigate and make it easier to find what you need quickly. Since most site visitors are looking for either ACE kits or documentation, there are direct links to those sections of the site right on the top banner of each page. There are also expanded sections for the ACE books including supplemental information such as errata and sample chapters. We're also filling out the platform-specific pages to give more helpful information on tools and tips for using ACE across the platforms the Riverace supports. If you have any feedback on the site, or ideas on what could be done to further improve its usefulness, please send email to shuston@riverace.com with your ideas. New Project Coming Up?If you're planning a new project to start soon, or find yourself grappling with how to apply ACE to your current project, remember that Riverace provides world-class development and consulting services with special expertise in ACE. We can help you be sure that your new system is designed to take full advantage of ACE's power and flexibility, getting your system delivered in the shortest possible time and with the highest level of quality. Please contact Steve Huston at 508-541-9180 to discuss how Riverace can help you. |
Useful ACE Information
Quotables"I also wanted to take this opportunity to express my appreciation for the quality and responsiveness of your organization. It is a very rare pleasure to work with an organization that provides in-depth technical support while remaining strongly customer focused - a fact you clearly demonstrate on every interaction. With your help, we have been able to dramatically improve our development schedule while reducing the overall cost and resources required. Riverace has exceeded our expectations without exception." Christopher W. Midgley This Newsletter...... is produced by Riverace Corporation to educate the ACE user community about ACE and available ACE resources, give tips on how to use ACE more effectively, and explain how Riverace can help you make the most of this powerful toolkit. About UsRiverace Corporation is the premier support service provider for the ACE toolkit worldwide. Steve Huston, Riverace's President/CEO and founder, has over 20 years' experience developing network protocols and applications. He has coauthored three books on ACE's design and usage and is considered an expert by ACE users around the world. Riverace has been focused on providing world-class technical support and consulting services for ACE since 1997. |