Dear ACE user,
Welcome to the October 2005 edition of Riverace's ACE News and
Tips newsletter. This issue contains information about our upcoming
How to Use ACE Effectively training class, a primer about
using the ACE_Reactor reference-counting facility with
ACE_Event_Handlers, and news about what's coming up in the next ACE
|Using ACE_Reactor Reference Counting With
Following up on last
month's topic of memory management for Reactor-driven
event handlers, this month we cover an added consideration:
managing objects in the presence of multiple threads. This
article gives a brief overview of the issues and a primer on
how to use the Reactor framework's reference-counting
mechanism introduced in ACE 5.4. This topic is also covered in
a bit more depth in Knowledge Base article 4
(available to Riverace's support customers).
As noted in C++NPv2
chapter 4, the various reactor implementations vary to some
degree in their dispatching and synchronization behavior in
the presence of multiple threads. It's a relatively simple
matter (as far as simple goes when considering
synchronization, that is) to serialize access across the
standard I/O callbacks (handle_input, handle_output, and
handle_exception). However, when it comes to knowing when it's
safe to delete an event handler object, it gets harder to
ensure a safe deletion without deleting the object out from
under a concurrent callback.
To effectively address these situations, ACE 5.4 and later
implements a reference counting scheme in the Reactor
framework. It effectively maintains a reference count that's
incremented on each operation (such as initial handler
registration and each dispatch operation) and decremented when
complete (final handler unregistration and dispatch
completion). When the reference count goes to 0, the Reactor
framework deletes the event handler. This scheme ensures that
an event handler is deleted only when it is not referenced any
To preserve pre-ACE-5.4 functionality, the Reactor
framework's event handler reference counting functionality is
disabled by default. It must be enabled on each
ACE_Event_Handler object individually, prior to its use in any
Reactor method call. To enable reference counting on a
handler, add code like this to its constructor or other
initialization point, before the object is used in any reactor
// Enable reference counting.
That is all you need. Be sure you don't delete the
handler yourself, unless you need to before registering it
with the reactor. Once registered for reactor event handling,
the reactor will take care of deleting the handler when there
are no reactor registrations and no more callbacks in
|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 or changed since last
- Native library path-searching. Previous ACE versions's
implementation of ACE_DLL (used in loading dynamic services)
implemented a search of the configured path-search to try
and locate the desired library file (DLL) and then used the
full pathname to load the library. This skirted some
platforms's rules for path search and security settings.
This has been changed in the next ACE version to make use of
all of the native platform's path-search and security
- Improved wide-character support. Wide- character support
has been included in ACE for many years on Windows (also
known as Unicode builds). However, wide-character support
for POSIX platforms has been sorely lacking. As ACE's reach
expands, this has become a more important issue. Riverace is
leading the completion of wide-character support in the next
version of ACE. This support is also available now in the
ACE 5.4b fix kit.
- GNU autotools support. Riverace is the lead developer in
charge of adding auto-configure support to ACE. For
native-build, non-Windows systems, autoconf will very likely
become the way to configure and build ACE. This will help
insure that ACE uses the latest features available on each
supported platform, and reduce the work required to build
ACE. No more picking the right config.h or
platform_macros.GNU file. Just do ./configure then make.
- Support for g++ 4.0, 3.4 and Microsoft Visual C++ 2005
are being added.
- Support for Red Hat Enterprise Linux 4.
- Support for Solaris 10.
- Support for Microsoft Visual Studio 2005 on
desktop, Pocket PC 2003, and Windows Mobile 5.0.
- Support for IBM AIX 5.3 on POWER with IBM's C++
- Support for HP-UX 11iv2 on both Itanium2 and
- Newer C++ Features Being Used. As the range of
ACE-supported compilers matures and older compilers are
taken out of service, ACE can make more use of newer C++
features while still maintaining its stellar portability
record. For example, many methods that returned 1 or 0 as an
int now return bool. Small steps, yes, but significant ones.
You'll see more modern C++ usage as time goes on.
- The ACE and ACE_OS classes, previously containing a
number of static member functions, are now C++ namespaces.
Similar ACE-internal classes, such as ACE_Sock_Connect, are
no longer in use.
- Completed ACE_Dev_Poll_Reactor. Sharpcast
is sponsoring Riverace's work to complete this important
class, enabling use of the new epoll facility on newer Linux
kernels. Thanks to Sharpcast's forward-thinking investment
in this important class, the entire ACE user community will
benefit from the greatly increased scalability of the
Reactor framework on Linux.
As you can see, the pace of changes is slowing and the ACE
development team is beginning to focus more on testing in
preparation for the release of ACE 5.5. The current estimate
for ACE 5.5's release is late in 2005, so there's time to get
a bit more in.
|"How to Use ACE Effectively" Training Class: October
HURRY! ONLY 2 DAYS LEFT TO REGISTER!!!
We've scheduled an open enrollment How to Use ACE
Effectively class for October 17-19, 2005 in Waltham, MA
(in the Boston area). This is a 3-day class, priced at
US$1,250 including continental breakfast, snacks and lunch
each day. Each attendee receives a copy of the class slides
and a copy of "The ACE Programmer's Guide" (since Steve Huston
will be teaching the class, he'll be happy to sign anyone's
Attendees also receive a 10% savings on ACE Annual Support
purchased when you pay for your class! Take advantage of this
opportunity to make the most of your new ACE knowledge and
keep the momentum going back at the office with quick answers
and direction on your project's issues!
Featured Book: C++ Network Programming, Volume 2
Now in its second printing, this widely acclaimed book
covers the major frameworks in ACE, how and why they're
designed as they are, and examples for how to use them. This
book also contains in-depth analysis of the "how and why" of
the ACE Reactor framework's design and usage, including more
information about the ACE_Event_Handler, discussed in this
issue of the newsletter. Every serious ACE user should have
this book on their desk at all times. Buy it now from amazon.com...