Footnotes

Chapter 1

1 If you'd like more information on Open Source Software in general, please visit the Open Source Initiative page on the web at http://www.opensource.org/.

2 It wouldn't surprise us if there were also other possible values, such as 8 bits or 64 bits. The point is: Don't count on a particular size.

3 The config.h file for these does not define ACE_HAS_NONSTATIC_OBJECT_MANAGER.

4 No, Windows is definitely not one of those platforms.

5 For more information on Doxygen, please see http://www.doxygen.org/.

Chapter 3

1 Although nothing is particularly magic about the port 20009, a standard set of ports is typically used by the ACE examples and tests. Throughout this text, we have tried to maintain consistency with that set.

2 One of the most exciting is the ability to reconfigure the service object while the application is running. In the context of our logging strategy, this means that you can change the -p value to reconfigure the logging level without stopping and restarting your application!

Chapter 6

1 The write(1,...) should send the output to the standard output, such as the console, for your operating system. However, that may mean something completely different for an embedded application. The point? Beware of portability issues at all times, and try to avoid things like write(1,...).

2 Note: Although ACE requires you to use delete[] to free the allocated memory, this can cause heap problems on Windows if ACE allocates from one heap and your application frees it to another. Be very careful to use the same C/C++ runtime library as the one your ACE program links with.

Chapter 7

1 Why handle_input() and not something like handle_accept()? This is a historical artifact based on the fact that in the BSD select() function, listening sockets that receive a connection request are selected as readable; there is no such thing as “acceptable” in select().

2 If you use the thread-pool reactor (ACE_TP_Reactor), the handlers share a pool of threads rather than just one. The current_time is still important, however, because you will likely register more handlers than the number of threads in the pool. Because of this shared nature, if you have timers that must be handled at exactly the timeout interval, a dedicated thread or process might be your only option.

3 If our design allowed us to use a handler instance per sensor, the handler would likely have a TemperatureSensor member variable. Part of the reason for the one-handler design, however, is to make it easy to maintain an average temperature. Of course, the primary reason for our design is to illustrate the use the second parameter to handle_timeout().

Chapter 8

1 Use of timers in the Proactor framework does require cleanup, however. The cleanup requirements for timer use in the Proactor framework are similar to those for the Reactor framework.

Chapter 17

1 It is important that the offset you specify into the file be properly aligned. This alignment is platform specific and can be obtained by calling ACE::getpagesize() on UNIX/POSIX platforms and by calling ACE_OS::allocation_granularity() on Windows.

Chapter 18

1 Obviously, a more realistic application would be structured to read a list of devices from a configuration file and listen to several at one time.

2 Although this example doesn't take advantage of it, don't forget that an ACE_Task can be made to use many threads. Such tasks are allowed and, in fact, encouraged in a stream because they can greatly improve the stream's throughput.

3 Message is a simple data object designed to hold a recorded message and information about that message. It's not a derivative of ACE_Message_Block. Note also that we're doing a very dangerous thing here by treating the data area as a Message instance. We never actually created the Message object; therefore, its constructor was never invoked. This is OK because it is a simple data object with no virtual functions. If it were more complex, we would want to use the placement new operator to instantiate the Message into the message block's data area.

4 The module_close() method is better suited to shutting down a task when a stream is closed. Old-time users of ACE will most likely be familiar with the close() approach, however, which is why we've presented it here.

5 Astute readers may think there is a memory leak here. What happens when the last of the task's threads puts the message back into the queue? As it turns out, when the message queue is destructed, which it will be when its containing task is destructed, it will iterate through any remaining message blocks it contains and call release() on each of them.

6 In fact, it will return the same instance in this particular implementation.

Chapter 21

1 Because the Naming Service is generally considered an advanced topic, it will frequently be used alongside other advanced features of ACE. In particular, it is frequently used in applications that rely on the Service Configurator. In these situations, the context's parse_args() is fed from the svc.conf file's data. In order to keep the example focused and a little simpler, we've chosen not to use the Service Configurator.

2 The optional type is always stored as a narrow-, or one-byte, character string.

3 You can also provide resolve() with a character pointer for the value parameter if you know that's what was stored in the Naming Service in the first place.

4 Several other useful methods allow you to query the context for values or types. In each case, you can receive a set of things—names, values, or types—that match your pattern or a set of ACE_Name_Binding instances, as we've done with list_name_entries().

5 Remember the memory allocation issues that the Name_Binding wrapper solves for us.

6 Please refer to Section 19.3 for details on configuring dynamic services.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.61.142