The Reactor An Object-Oriented Wrapper for Event-Driven Port Monitoring and Service Demultiplexing (Part 1 of 2)

Douglas C. Schmidt · 1998

This is part one of the third article in a series that describes techniques for encapsulating existing operating system (OS) interprocess communication (IPC) services within objectoriented (OO) C++ wrappers. The first article explains the main principles and motivations for OO wrappers [1], which simplify the development of correct, concise, portable, and efficient applications. The second article describes an OO wrapper called IPC SAP [2] that encapsulates the BSD socket and System V TLI system call Application Programmatic Interfaces (APIs). IPC SAP enables application programs to access local and remote IPC protocol families such as TCP/IP via a type-secure, object-oriented interface. This third article presents an OO wrapper for the I/O port monitoring and timer-based event notification facilities provided by the select and poll system calls.1 Both select and poll enable applications to specify a time-out interval to wait for the occurrence of different types of input and output events on one or more I/O descriptors. select and poll detect when certain I/O or timer events occur and demultiplex these events to the appropriate application(s). As with many other OS APIs, the event demultiplexing interfaces are complicated, error-prone, non-portable, and not easily extensible. An extensible OO framework called the Reactorwas developed to overcome these limitations. The Reactor provides a set of higher-level programming abstractions that simplify the design and implementation of event-driven distributed applications. The Reactor also shields developers from many error-prone details in the existing event demultiplexing APIs and improves application portability between different OS variants. The Reactor is somewhat different than the IPC SAP class wrapper described in [2]. IPC SAP added a relatively “thin” OO veneer to the BSD socket and System V TLI APIs. On the other hand, the Reactor provides a signif-

Read the paper · More papers on PaperTik