summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1998-09-19 19:31:02 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1998-09-19 19:31:02 +0000
commit1963b3a713ff77474302a2b66312e6c027868a3a (patch)
tree75c2e7438000833d1ba80e7f454e41bec23f7e5b /examples
parent57adc36d6ec0e4a32bc586b9a8a6faba4f30ba49 (diff)
downloadATCD-1963b3a713ff77474302a2b66312e6c027868a3a.tar.gz
*** empty log message ***
Diffstat (limited to 'examples')
-rw-r--r--examples/Bounded_Packet_Relay/BPR_Drivers.cpp135
-rw-r--r--examples/Bounded_Packet_Relay/BPR_Drivers.h167
-rw-r--r--examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.cpp241
-rw-r--r--examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.h104
-rw-r--r--examples/Bounded_Packet_Relay/bpr_thread.cpp5
5 files changed, 324 insertions, 328 deletions
diff --git a/examples/Bounded_Packet_Relay/BPR_Drivers.cpp b/examples/Bounded_Packet_Relay/BPR_Drivers.cpp
index 542fe67aa5a..a316e5e58e0 100644
--- a/examples/Bounded_Packet_Relay/BPR_Drivers.cpp
+++ b/examples/Bounded_Packet_Relay/BPR_Drivers.cpp
@@ -28,7 +28,8 @@
ACE_RCSID(Bounded_Packet_Relay, BPR_Driver, "$Id$")
-Input_Device_Wrapper_Base::Input_Device_Wrapper_Base (ACE_Thread_Manager * input_task_mgr)
+Input_Device_Wrapper_Base::Input_Device_Wrapper_Base (ACE_Thread_Manager *input_task_mgr)
+ // @@ Chris, please fix this formatting as per other comments ...
: ACE_Task_Base (input_task_mgr)
, send_input_msg_cmd_ (0)
, input_rate_ (ACE_ONE_SECOND_IN_USECS)
@@ -38,7 +39,7 @@ Input_Device_Wrapper_Base::Input_Device_Wrapper_Base (ACE_Thread_Manager * input
}
// ctor
-Input_Device_Wrapper_Base::Input_Device_Wrapper_Base ()
+Input_Device_Wrapper_Base::Input_Device_Wrapper_Base (void)
{
delete send_input_msg_cmd_;
}
@@ -79,7 +80,6 @@ Input_Device_Wrapper_Base::request_stop (void)
// and terminate its thread. Should return 1 if it will do so, 0
// if it has already done so, or -1 if there is a problem doing so.
-
int
Input_Device_Wrapper_Base::svc (void)
{
@@ -91,13 +91,13 @@ Input_Device_Wrapper_Base::svc (void)
is_active_ = 1;
// start with the total count of messages to send
- count = send_count_;
-
- // while we're still marked active, and there are packets to send
- while ((is_active_) && (count != 0))
+ for (count = send_count_;
+ // while we're still marked active, and there are packets to send
+ is_active_ && count != 0;
+ )
{
// make sure there is a send command object
- if (! send_input_msg_cmd_)
+ if (send_input_msg_cmd_ == 0)
{
is_active_ = 0;
ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n",
@@ -107,7 +107,7 @@ Input_Device_Wrapper_Base::svc (void)
// create an input message to send
message = create_input_message ();
- if (! message)
+ if (message == 0)
{
is_active_ = 0;
ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n",
@@ -129,9 +129,8 @@ Input_Device_Wrapper_Base::svc (void)
// and run the reactor event loop unti we get a timeout
// or something happens in a registered upcall.
if (count > 0)
- {
--count;
- }
+
timeout = ACE_Time_Value (0, period_);
reactor_.run_event_loop (timeout);
}
@@ -146,27 +145,25 @@ int
Input_Device_Wrapper_Base::send_input_message (ACE_Message_Block *amb)
{
if (send_input_msg_cmd_)
- {
return send_input_msg_cmd_->execute ((void *) amb);
- }
else
- {
- ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n",
- "Input_Device_Wrapper_Base::send_input_message: "
- "command object not instantiated"),
- -1);
- }
+ {
+ ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n",
+ "Input_Device_Wrapper_Base::send_input_message: "
+ "command object not instantiated"),
+ -1);
+ }
}
// sends a newly created message block, carrying data
// read from the underlying input device, by passing a
// pointer to the message block to its command execution
template <class SYNCH>
-Bounded_Packet_Relay<SYNCH>::Bounded_Packet_Relay (
- ACE_Thread_Manager * input_task_mgr,
- Input_Device_Wrapper_Base * input_wrapper,
- Output_Device_Wrapper_Base * output_wrapper)
+Bounded_Packet_Relay<SYNCH>::Bounded_Packet_Relay (ACE_Thread_Manager *input_task_mgr,
+ Input_Device_Wrapper_Base *input_wrapper,
+ Output_Device_Wrapper_Base *output_wrapper)
: input_task_mgr_ (input_task_mgr)
+ // @@ Chris, please fix the formatting...
, input_wrapper_ (input_wrapper)
, input_thread_handle_ (0)
, output_wrapper_ (output_wrapper)
@@ -180,9 +177,7 @@ Bounded_Packet_Relay<SYNCH>::Bounded_Packet_Relay (
, elapsed_duration_ (0)
{
if (input_task_mgr_ == 0)
- {
input_task_mgr_ = ACE_Thread_Manager::instance ();
- }
}
// ctor
@@ -201,17 +196,13 @@ Bounded_Packet_Relay<SYNCH>::send_input (void)
// don't block, return immediately if queue is empty
if (queue_.dequeue_head (item, ACE_OS::gettimeofday ()) < 0)
- {
return 1;
- }
// if a message block was dequeued, send it to the output device
if (output_wrapper_->write_output_message ((void *) item) < 0)
- {
ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n",
"failed to write to output device object"),
-1);
- }
// if all went OK, increase count of packets sent
++packets_sent_;
@@ -230,9 +221,7 @@ Bounded_Packet_Relay<SYNCH>::start_transmission (u_long packet_count,
// if a transmission is already in progress, just return
if (status_ == STARTED)
- {
return 1;
- }
// Update statistics for a new transmission
++transmission_number;
@@ -284,9 +273,7 @@ Bounded_Packet_Relay<SYNCH>::end_transmission (Transmission_Status status)
// if a transmission is not already in progress, just return
if (status_ != STARTED)
- {
return 1;
- }
// ask the the input thread to stop
if (input_wrapper_->request_stop () < 0)
@@ -324,9 +311,7 @@ Bounded_Packet_Relay<SYNCH>::report_statistics (void)
// if a transmission is already in progress, just return
if (status_ == STARTED)
- {
return 1;
- }
const char *status_msg;
switch (status_)
@@ -334,28 +319,22 @@ Bounded_Packet_Relay<SYNCH>::report_statistics (void)
case UN_INITIALIZED:
status_msg = "Uninitialized";
break;
-
case STARTED:
// NOT REACHED: user should never see this ;-)
status_msg = "In progress";
break;
-
case COMPLETED:
status_msg = "Completed with all packets sent";
break;
-
case TIMED_OUT:
status_msg = "Terminated by transmission duration timer";
break;
-
case CANCELLED:
status_msg = "Cancelled by external control";
break;
-
case ERROR:
status_msg = "Error was detected";
break;
-
default:
status_msg = "Unknown";
break;
@@ -366,6 +345,7 @@ Bounded_Packet_Relay<SYNCH>::report_statistics (void)
duration -= transmission_start_;
// report transmission statistics
+ // @@ Chris, please don't use ACE_OS::fprintf(), use ACE_DEBUG or ACE_ERROR instead...
if (ACE_OS::fprintf (ACE_STDOUT,
"\n\nStatisics for transmission %lu:\n\n"
"Transmission status: %s\n"
@@ -381,19 +361,18 @@ Bounded_Packet_Relay<SYNCH>::report_statistics (void)
duration.sec (),
duration.usec (),
packets_sent_) < 0)
- {
ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n",
"Bounded_Packet_Relay<SYNCH>::report_statistics"
- "ACE_OS::fprintf failed"), -1);
- }
+ "ACE_OS::fprintf failed"),
+ -1);
+ // @@ Chris, if you use ACE_DEBUG or ACE_ERROR you won't need to use
+ // fflush here....
if (ACE_OS::fflush (ACE_STDOUT) < 0)
- {
ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n",
"Bounded_Packet_Relay<SYNCH>::report_statistics"
- "ACE_OS::fflush failed"), -1);
- }
-
+ "ACE_OS::fflush failed"),
+ -1);
return 0;
}
// Requests a report of statistics from the last transmission.
@@ -401,17 +380,12 @@ Bounded_Packet_Relay<SYNCH>::report_statistics (void)
template <class SYNCH> int
Bounded_Packet_Relay<SYNCH>::receive_input (void * arg)
{
- ACE_Message_Block *message;
-
- message = ACE_static_cast (ACE_Message_Block *, arg);
-
+ ACE_Message_Block *message = ACE_static_cast (ACE_Message_Block *,
+ arg);
if (queue_.enqueue_tail (message) < 0)
- {
ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n",
"Bounded_Packet_Relay<SYNCH>::receive_input failed"),
-1);
- }
-
return 0;
}
// public entry point to which to push input.
@@ -436,17 +410,15 @@ Bounded_Packet_Relay_Driver<TQ, RECEIVER, ACTION>::parse_commands (const char *b
// We just reread the option, this simplies parsing
// (since sscanf can do it for us.)
if (::sscanf (buf, "%d %lu", &option, &count) < 2)
- {
// if there was not enough information on the line,
// ignore option and try the next line.
return 0;
- }
if (packet_count_cmd_->execute ((void *) &count) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "set packet count failed"), -1);
- }
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%t %p\n",
+ "set packet count failed"),
+ -1);
break;
}
@@ -457,17 +429,15 @@ Bounded_Packet_Relay_Driver<TQ, RECEIVER, ACTION>::parse_commands (const char *b
// We just reread the option, this simplies parsing
// (since sscanf can do it for us.)
if (::sscanf (buf, "%d %lu", &option, &usec) < 2)
- {
// if there was not enough information on the line,
// ignore option and try the next line.
return 0;
- }
if (arrival_period_cmd_->execute ((void *) &usec) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "set arrival period failed"), -1);
- }
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%t %p\n",
+ "set arrival period failed"),
+ -1);
break;
}
@@ -478,17 +448,15 @@ Bounded_Packet_Relay_Driver<TQ, RECEIVER, ACTION>::parse_commands (const char *b
// We just reread the option, this simplies parsing
// (since sscanf can do it for us.)
if (::sscanf (buf, "%d %lu", &option, &usec) < 2)
- {
// if there was not enough information on the line,
// ignore option and try the next line.
return 0;
- }
if (transmit_period_cmd_->execute ((void *) &usec) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "set transmit period failed"), -1);
- }
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%t %p\n",
+ "set transmit period failed"),
+ -1);
break;
}
@@ -499,17 +467,15 @@ Bounded_Packet_Relay_Driver<TQ, RECEIVER, ACTION>::parse_commands (const char *b
// We just reread the option, this simplies parsing
// (since sscanf can do it for us.)
if (::sscanf (buf, "%d %lu", &option, &usec) < 2)
- {
// if there was not enough information on the line,
// ignore option and try the next line.
return 0;
- }
if (duration_limit_cmd_->execute ((void *) &usec) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "set duration limit failed"), -1);
- }
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%t %p\n",
+ "set duration limit failed"),
+ -1);
break;
}
@@ -520,17 +486,15 @@ Bounded_Packet_Relay_Driver<TQ, RECEIVER, ACTION>::parse_commands (const char *b
// We just reread the option, this simplies parsing
// (since sscanf can do it for us.)
if (::sscanf (buf, "%d %lu", &option, &level) < 2)
- {
// if there was not enough information on the line,
// ignore option and try the next line.
return 0;
- }
if (logging_level_cmd_->execute ((void *) &level) == -1)
- {
- ACE_ERROR_RETURN ((LM_ERROR, "%t %p\n", "set logging level failed"), -1);
- }
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%t %p\n",
+ "set logging level failed"),
+ -1);
break;
}
@@ -580,6 +544,7 @@ Bounded_Packet_Relay_Driver<TQ, RECEIVER, ACTION>::get_next_request (void)
this->display_menu ();
+ // @@ Chris, please don't use ACE_OS::fprintf, use ACE_DEBUG here...
ACE_OS::fprintf (ACE_STDERR, "Please enter your choice: ");
ACE_OS::fflush (ACE_STDERR);
diff --git a/examples/Bounded_Packet_Relay/BPR_Drivers.h b/examples/Bounded_Packet_Relay/BPR_Drivers.h
index b583dc8edcf..32f40ba64a4 100644
--- a/examples/Bounded_Packet_Relay/BPR_Drivers.h
+++ b/examples/Bounded_Packet_Relay/BPR_Drivers.h
@@ -1,5 +1,4 @@
/* -*- C++ -*- */
-
// $Id$
// ============================================================================
@@ -27,50 +26,55 @@
#define _BPR_DRIVER_H_
#include "ace/Task.h"
-// #include "ace/Timer_Heap_T.h"
-// #include "ace/Timer_Queue_Adapters.h"
class Command_Base
+// @@ Chris, make sure that you ALWAYs put the opening '{' BEFORE the
+// =TITLE and =DESCRIPTION comments. Otherwise, it's hard to format
+// correctly via emacs. I've reformatted most of the comments in the
+// *.h files, but I left this one to show how you were doing it
+// incorrectly.
// = TITLE
// Defines an abstract class that allows us to invoke commands
- // without knowing anything about the implementation.
+ // without knowing anything about the implementation.
//
// = DESCRIPTION
- // This class declares an interface to execute a command independent
- // of the effect of the command, or the objects used to implement it.
+ // This class declares an interface to execute a command
+ // independent of the effect of the command, or the objects used
+ // to implement it.
{
public:
-
virtual int execute (void *arg) = 0;
// Invokes the method <action_> from the object <receiver_>.
-
};
-
class Input_Device_Wrapper_Base : public ACE_Task_Base
+{
// = TITLE
- // Defines an abstract base class for an input device wrapper that hides
- // the details of the specific device and provides a consistent message
- // passing interface without knowing anything about the implementation
- // of the input device or the message receiver.
+ // Defines an abstract base class for an input device wrapper
+ // that hides the details of the specific device and provides a
+ // consistent message passing interface without knowing anything
+ // about the implementation of the input device or the message
+ // receiver.
//
- // The abstract base class ctor takes a command template object that is
- // instantiated with the correct receiver and action types. This command
- // object is used to send newly created input messages to the receiver.
+ // The abstract base class ctor takes a command template object
+ // that is instantiated with the correct receiver and action
+ // types. This command object is used to send newly created input
+ // messages to the receiver.
//
- // The abstract base class is designed to operate in an active "push"
- // mode, sending input data to the receiver whenever the data is ready.
- // The underlying device may be active, notifying the wrapper when
- // data is ready, or may be passive in which case the wrapper must
- // rely on a reactive and/or polling mechanism.
+ // The abstract base class is designed to operate in an active
+ // "push" mode, sending input data to the receiver whenever the
+ // data is ready. The underlying device may be active, notifying
+ // the wrapper when data is ready, or may be passive in which
+ // case the wrapper must rely on a reactive and/or polling
+ // mechanism.
//
// = DESCRIPTION
- // Derived classes are responsible for filling in concrete definitions
- // for the abstract message creation method and the svc method.
-{
+ // Derived classes are responsible for filling in concrete
+ // definitions for the abstract message creation method and the
+ // svc method.
public:
-
- Input_Device_Wrapper_Base (ACE_Thread_Manager * input_task_mgr);
+ // = Initialization and termination methods.
+ Input_Device_Wrapper_Base (ACE_Thread_Manager *input_task_mgr);
// ctor
virtual ~Input_Device_Wrapper_Base ();
@@ -86,23 +90,22 @@ public:
// sets count of messages to send
int request_stop (void);
- // request that the input device stop sending messages
- // and terminate its thread. Should return 1 if it will do so, 0
- // if it has already done so, or -1 if there is a problem doing so.
+ // request that the input device stop sending messages and terminate
+ // its thread. Should return 1 if it will do so, 0 if it has
+ // already done so, or -1 if there is a problem doing so.
virtual int svc (void);
// This method runs the input device loop in the new thread.
protected:
-
- virtual ACE_Message_Block *create_input_message () = 0;
- // creates a new message block, carrying data
- // read from the underlying input device
+ virtual ACE_Message_Block *create_input_message (void) = 0;
+ // creates a new message block, carrying data read from the
+ // underlying input device
virtual int send_input_message (ACE_Message_Block *);
- // sends a newly created message block, carrying data
- // read from the underlying input device, by passing a
- // pointer to the message block to its command execution
+ // sends a newly created message block, carrying data read from the
+ // underlying input device, by passing a pointer to the message
+ // block to its command execution
Command_Base *send_input_msg_cmd_;
// send newly created input message.
@@ -114,51 +117,62 @@ protected:
// reactor used to multiplex input streams, timeouts
int is_active_;
- // flag to indicate whether or not input object
- // is and should remain active
+ // flag to indicate whether or not input object is and should remain
+ // active
long send_count_;
- // count of messages to send before stopping
- // (-1 indicates the device should not stop)
+ // count of messages to send before stopping (-1 indicates the
+ // device should not stop)
};
-
class Output_Device_Wrapper_Base
+{
// = TITLE
- // Defines an abstract base class for an output device wrapper that hides
- // the details of the specific device and provides a consistent write
- // method interface without knowing anything about the implementation.
+ // Defines an abstract base class for an output device wrapper
+ // that hides the details of the specific device and provides a
+ // consistent write method interface without knowing anything
+ // about the implementation.
//
// = DESCRIPTION
- // The abstract methods write_output_message () and modify_device_settings ()
- // are defined in derived classes to write the contents of the passed message
- // out the underlying output device, and update device settings, respectively.
-{
+ // The abstract methods write_output_message () and
+ // modify_device_settings () are defined in derived classes to
+ // write the contents of the passed message out the underlying
+ // output device, and update device settings, respectively.
public:
-
virtual int write_output_message (void *) = 0;
- // writes contents of the passed message block
- // out to the underlying output device
+ // writes contents of the passed message block out to the underlying
+ // output device
virtual int modify_device_settings (void *) = 0;
// provides an abstract interface to allow modifying device settings
};
-
template <class SYNCH>
class Bounded_Packet_Relay
{
+ // = TITLE
+ // @@ Chris, please fill in here.
+ //
+ // = DESCRIPTION
+ // @@ Chris, please fill in here.
public:
-
typedef int (Input_Task::*ACTION) (void *);
// Command entry point type definition
- enum Transmission_Status {UN_INITIALIZED, STARTED, COMPLETED, TIMED_OUT, CANCELLED, ERROR};
- // enumerates possible status values at the end of a transmission
-
- Bounded_Packet_Relay (ACE_Thread_Manager * input_task_mgr,
- Input_Device_Wrapper_Base * input_wrapper,
- Output_Device_Wrapper_Base * output_wrapper);
+ // = Enumerates possible status values at the end of a transmission.
+ enum Transmission_Status
+ {
+ UN_INITIALIZED,
+ STARTED,
+ COMPLETED,
+ TIMED_OUT,
+ CANCELLED,
+ ERROR
+ };
+
+ Bounded_Packet_Relay (ACE_Thread_Manager *input_task_mgr,
+ Input_Device_Wrapper_Base *input_wrapper,
+ Output_Device_Wrapper_Base *output_wrapper);
// ctor
virtual ~Bounded_Packet_Relay (void);
@@ -178,18 +192,13 @@ public:
int report_statistics (void);
// Requests a report of statistics from the last transmission.
- /////////////////////////////////////
- // Command Accessible Entry Points //
- /////////////////////////////////////
+ // = Command Accessible Entry Points.
int receive_input (void *);
// public entry point to which to push input.
private:
-
- ////////////////////////////
- // Concurrency Management //
- ////////////////////////////
+ // = Concurrency Management.
ACE_Thread_Manager * input_task_mgr_;
// Thread manager for the input device task
@@ -206,9 +215,7 @@ private:
// lock for safe thread synchronization
// of transmission startup and termination
- /////////////////////////////
- // Transmission Statistics //
- /////////////////////////////
+ // = Transmission Statistics
u_long transmission_number_;
// number of transmissions sent
@@ -224,11 +231,11 @@ private:
ACE_Time_Value transmission_end_;
// ending time of the most recent transmission
-
};
template <class TQ>
class Bounded_Packet_Relay_Driver
+{
// = TITLE
// Defines a class that provides a simmple implementation for
// a test driver for timer queues.
@@ -240,26 +247,25 @@ class Bounded_Packet_Relay_Driver
// read_input () and get_next_request () methods. Subclasses can
// override these methods if there is some logic that is specific
// to that implementation.
-{
public:
-
virtual int parse_commands (const char *buf);
- // Breaks up the input string buffer into pieces and executes
- // the appropriate method to handle that operation.
+ // Breaks up the input string buffer into pieces and executes the
+ // appropriate method to handle that operation.
virtual int run (void);
- // This is the main entry point for the driver. The user
- // of the class should normally invoke this method.
- // Returns 0 when successful, or 0 otherwise.
+ // This is the main entry point for the driver. The user of the
+ // class should normally invoke this method. Returns 0 when
+ // successful, or 0 otherwise.
virtual int get_next_request (void);
// This internal method gets the next request from the user.
// Returns -1 when user wants to exit. Returns 0 otherwise.
virtual ssize_t read_input (char *buf, size_t bufsiz);
- // Reads input from the user into the buffer <buf> with a maximum
- // of <bufsiz> bytes. Returns the amount of bytes actually read
- // Otherwise, a -1 is returned and errno is set to indicate the error.
+ // Reads input from the user into the buffer <buf> with a maximum of
+ // <bufsiz> bytes. Returns the amount of bytes actually read
+ // Otherwise, a -1 is returned and errno is set to indicate the
+ // error.
virtual int display_menu (void);
// Prints the user interface for the driver to STDOUT.
@@ -268,7 +274,6 @@ public:
// Initializes values and operations for the driver.
protected:
-
// = Major Driver Mechanisms
TQ timer_queue_;
diff --git a/examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.cpp b/examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.cpp
index 17d9f2d947e..55475bc13d9 100644
--- a/examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.cpp
+++ b/examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.cpp
@@ -9,7 +9,7 @@
// Thread_Bounded_Packet_Relay.cpp
//
// = DESCRIPTION
-// Method definitions for a threaded bounded packet relay
+// Method definitions for the threaded-bounded packet relay class.
//
// = AUTHORS
// Chris Gill <cdgill@cs.wustl.edu>
@@ -21,14 +21,13 @@
//
// ============================================================================
-ACE_RCSID(Bounded_Packet_Relay, Thread_Bounded_Packet_Relay, "$Id$")
-
#include "ace/Task.h"
#include "ace/Timer_Heap_T.h"
#include "ace/Timer_Queue_Adapters.h"
-
#include "Thread_Bounded_Packet_Relay.h"
+ACE_RCSID(Bounded_Packet_Relay, Thread_Bounded_Packet_Relay, "$Id$")
+
// constructor
template <class RECEIVER, class ACTION>
@@ -47,10 +46,17 @@ Command<RECEIVER, ACTION>::execute (void *arg)
return (receiver_.*action_) (arg);
}
-
-Text_Input_Device_Wrapper::Text_Input_Device_Wrapper (ACE_Thread_Manager * input_task_mgr,
- size_t read_length, const char* text)
+Text_Input_Device_Wrapper::Text_Input_Device_Wrapper (ACE_Thread_Manager *input_task_mgr,
+ size_t read_length,
+ const char* text)
: Input_Device_Wrapper_Base (input_task_mgr)
+ // @@ Chris, your coding style here is not consistent with the rest of ACE. this
+ // should be
+ // : Input_Device.... (....),
+ // read_length_ (....),
+ // text_ (....),
+ // index_ (0)
+ // Please be follow this in the future.
, read_length_ (read_length)
, text_ (text)
, index_ (0)
@@ -58,15 +64,17 @@ Text_Input_Device_Wrapper::Text_Input_Device_Wrapper (ACE_Thread_Manager * input
}
// ctor
-Text_Input_Device_Wrapper::~Text_Input_Device_Wrapper ()
+Text_Input_Device_Wrapper::~Text_Input_Device_Wrapper (void)
{
}
// dtor
-
ACE_Message_Block *
-Text_Input_Device_Wrapper::create_input_message ()
+Text_Input_Device_Wrapper::create_input_message (void)
{
+ // @@ Chris, make sure to use the proper capitalization and
+ // punctuation for these and all comments...
+
// construct a new message block to send
ACE_Message_Block *message;
ACE_NEW_RETURN (message,
@@ -80,23 +88,25 @@ Text_Input_Device_Wrapper::create_input_message ()
// loop through the text, filling in data to copy into
// the read buffer (leaving room for a terminating zero)
for (size_t i = 0; i < read_length_ - 1; ++i)
- {
- read_buf [i] = text_ [index_];
- index_ = (index_ + 1) % ACE_OS::strlen (text_);
- }
+ {
+ read_buf [i] = text_ [index_];
+ index_ = (index_ + 1) % ACE_OS::strlen (text_);
+ }
// Copy buf into the Message_Block and update the wr_ptr ().
if (mb->copy (read_buf, read_length_) < 0)
- {
- delete message;
- ACE_ERROR_RETURN ((LM_ERROR, "read buffer copy failed"), 0);
- }
+ {
+ delete message;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "read buffer copy failed"),
+ 0);
+ }
return message;
}
- // creates a new message block, carrying data
- // read from the underlying input device
+// creates a new message block, carrying data
+// read from the underlying input device
Text_Output_Driver_Wrapper::Text_Output_Driver_Wrapper (int logging)
: logging_ (logging)
@@ -109,20 +119,33 @@ Text_Output_Driver_Wrapper::write_output_message (void *message)
{
ACE_Message_Block *message;
}
- // consume and possibly print out the passed message
+
+// consume and possibly print out the passed message
int
Text_Output_Driver_Wrapper::modify_device_settings (void *logging)
{
+ // @@ Chris, your indentation throughout this file is not consistent
+ // with ACE coding guidelines. Please make sure you use the
+ // indentation format that GNU emacs provide. If you have any
+ // questions, please let me know.
if (logging)
{
- logging_ = * ACE_static_cast (int *, logging);
+ logging_ = *ACE_static_cast (int *, logging);
}
else
{
- ACE_ERROR_RETURN ((LM_ERROR, "null logging level pointer"), -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "null logging level pointer"),
+ -1);
}
}
+
+// @@ Chris, you are not intenting your comments correctly. The
+// comments before each method should be flush against the left column
+// and there should be only one blank line between the comments and
+// the method.
+
// modifies device settings based on passed pointer to a u_long
// turns logging on if u_long is non-zero, off if u_long is zero,
// and does nothing if the pointer is null.
@@ -136,6 +159,7 @@ User_Input_Task::User_Input_Task (Thread_Timer_Queue *queue,
driver_ (tbprd)
{
}
+
// ctor
int
@@ -150,9 +174,12 @@ User_Input_Task::svc (void)
// we are done.
this->relay_->end_transmission (Bounded_Packet_Relay_Driver::CANCELLED);
this->queue_->deactivate ();
- ACE_DEBUG ((LM_DEBUG, "terminating input thread\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "terminating input thread\n"));
return 0;
-}
+} // @@ Chris, you are putting the comments in the wrong place...
+ // They should go BEFORE the method, not after it... It's only in
+ // the header file that they must go after the method...
// This method runs the event loop in the new thread.
// = Some helper methods.
@@ -162,7 +189,7 @@ User_Input_Task::set_packet_count (void *argument)
{
if (argument)
{
- packet_count_ = * ACE_static_cast (int *, argument);
+ packet_count_ = *ACE_static_cast (int *, argument);
return 0;
}
@@ -177,7 +204,7 @@ User_Input_Task::set_arrival_period (void *argument)
{
if (argument)
{
- arrival_period_ = * ACE_static_cast (int *, argument);
+ arrival_period_ = *ACE_static_cast (int *, argument);
return 0;
}
@@ -193,7 +220,7 @@ User_Input_Task::set_send_period (void *argument)
{
if (argument)
{
- send_period_ = * ACE_static_cast (int *, argument);
+ send_period_ = *ACE_static_cast (int *, argument);
return 0;
}
@@ -209,7 +236,7 @@ User_Input_Task::set_duration_limit (void *argument)
{
if (argument)
{
- duration_limit_ = * ACE_static_cast (int *, argument);
+ duration_limit_ = *ACE_static_cast (int *, argument);
return 0;
}
@@ -224,7 +251,7 @@ User_Input_Task::set_logging_level (void *argument)
{
if (argument)
{
- logging_level_ = * ACE_static_cast (int *, argument);
+ logging_level_ = *ACE_static_cast (int *, argument);
return 0;
}
@@ -248,12 +275,13 @@ User_Input_Task::run_transmission (void *argument)
logging_level_))
{
case 1:
+ // @@ Chris, please don't use ACE_OS::fprintf() for things
+ // like this, use ACE_DEBUG or ACE_ERROR instead.
ACE_OS::fprintf (ACE_STDERR,
"\nRun transmission: "
"transmission already in progress\n");
return 0;
- /* not reached */
-
+ /* NOT REACHED */
case 0:
{
ACE_Time_Value now = ACE_OS::gettimeofday ();
@@ -342,11 +370,12 @@ User_Input_Task::end_transmission (void *argument)
case 0:
// cancel any remaining timers
- ACE_Timer_Node_T <ACE_Event_Handler *> *node;
- while ((node = queue_->timer_queue ().get_first ()))
- {
+
+ for (ACE_Timer_Node_T <ACE_Event_Handler *> *node;
+ (node = queue_->timer_queue ().get_first ()) != 0;
+ )
queue->cancel (node->get_timer_id (), 0);
- }
+
return 0;
/* not reached */
@@ -403,7 +432,7 @@ User_Input_Task::report_stats (void *argument)
// reports statistics for the previous transmission
// (if one is not in progress)
- int
+int
User_Input_Task::shutdown (void *argument)
{
// Macro to avoid "warning: unused parameter" type warning.
@@ -422,11 +451,11 @@ User_Input_Task::shutdown (void *argument)
}
// Shutdown task.
-
Send_Handler::Send_Handler (u_long send_count,
- const ACE_Time_Value &duration,
- Bounded_Packet_Relay<ACE_Thread_Mutex> &relay,
- Thread_Timer_Queue &queue)
+ const ACE_Time_Value &duration,
+ Bounded_Packet_Relay<ACE_Thread_Mutex> &relay,
+ Thread_Timer_Queue &queue)
+ // @@ Chris, please fix the formatting here...
: send_count_ (send_count)
, duration_ (duration)
, relay_ (relay)
@@ -445,42 +474,44 @@ Send_Handler::handle_timeout (const ACE_Time_Value &current_time,
const void *arg)
{
switch (relay_->send_input ())
- {
+ {
case 0:
// decrement count of packets to relay
--send_count_;
/* fall through to next case */
case 1:
if (send_count_ > 0)
- {
- // re-register the handler for a new timeout
- if (queue_->schedule (this, 0,
- duration_ + ACE_OS::gettimeofday ()) < 0)
{
- ACE_ERROR_RETURN ((LM_ERROR,
- "Send_Handler::handle_timeout: "
- "failed to reschedule send handler"),
- -1);
+ // re-register the handler for a new timeout
+ if (queue_->schedule (this, 0,
+ duration_ + ACE_OS::gettimeofday ()) < 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Send_Handler::handle_timeout: "
+ "failed to reschedule send handler"),
+ -1);
+ return 0;
}
- return 0;
- }
else
- {
- // all packets are sent, time to cancel any other
- // timers, end the transmission, and go away
- ACE_Timer_Node_T <ACE_Event_Handler *> *node;
- while ((node = queue_->timer_queue ().get_first ()))
{
- queue->cancel (node->get_timer_id (), 0);
+ // @@ Chris, I think you repeat this code a number of times.
+ // Can you please abstract it out into a helper method and
+ // call it, rather than writing it redundantly?
+
+ // all packets are sent, time to cancel any other
+ // timers, end the transmission, and go away
+ for (ACE_Timer_Node_T <ACE_Event_Handler *> *node;
+ (node = queue_->timer_queue ().get_first ()) != 0;
+ )
+ queue->cancel (node->get_timer_id (), 0);
+
+ relay_->end_transmission (Bounded_Packet_Relay::COMPLETED);
+ delete this;
+ return 0;
}
- relay_->end_transmission (Bounded_Packet_Relay::COMPLETED);
- delete this;
- return 0;
- }
- /* not reached */
+ /* NOT REACHED */
default:
return -1;
- }
+ }
}
// Call back hook.
@@ -492,9 +523,8 @@ Send_Handler::cancelled (void)
}
// Cancellation hook
-
Termination_Handler::Termination_Handler (Bounded_Packet_Relay<ACE_Thread_Mutex> &relay,
- Thread_Timer_Queue &queue)
+ Thread_Timer_Queue &queue)
: relay_ (relay)
, queue_ (queue)
{
@@ -508,15 +538,15 @@ Termination_Handler::~Termination_Handler (void)
int
Termination_Handler::handle_timeout (const ACE_Time_Value &current_time,
- const void *arg)
+ const void *arg)
{
// transmission timed out, cancel any other
// timers, end the transmission, and go away
- ACE_Timer_Node_T <ACE_Event_Handler *> *node;
- while ((node = queue_->timer_queue ().get_first ()))
- {
+ for (ACE_Timer_Node_T <ACE_Event_Handler *> *node;
+ (node = queue_->timer_queue ().get_first ()) != 0;
+ )
queue->cancel (node->get_timer_id (), 0);
- }
+
relay_->end_transmission (Bounded_Packet_Relay::TIMED_OUT);
delete this;
return 0;
@@ -531,19 +561,19 @@ Termination_Handler::cancelled (void)
}
// Cancellation hook
-Thread_Bounded_Packet_Relay_Driver::Thread_Bounded_Packet_Relay_Driver (void);
+Thread_Bounded_Packet_Relay_Driver::Thread_Bounded_Packet_Relay_Driver (void)
: input_task_ (&timer_queue_, *this)
{
}
// ctor
-Thread_Bounded_Packet_Relay_Driver::~Thread_Bounded_Packet_Relay_Driver (void);
+Thread_Bounded_Packet_Relay_Driver::~Thread_Bounded_Packet_Relay_Driver (void)
{
}
// dtor
int
-Thread_Bounded_Packet_Relay_Driver::display_menu (void);
+Thread_Bounded_Packet_Relay_Driver::display_menu (void)
{
static char menu[] =
"\n\n Options:\n"
@@ -563,7 +593,8 @@ Thread_Bounded_Packet_Relay_Driver::display_menu (void);
" 8 - report statistics from the most recent transmission\n"
" 9 - quit the program\n";
- ACE_OS::fprintf(ACE_STDERR, "%s", menu);
+ // @@ Chris, don't use ACE_OS::printf...
+ ACE_OS::fprintf (ACE_STDERR, "%s", menu);
return 0;
}
@@ -572,68 +603,72 @@ Thread_Bounded_Packet_Relay_Driver::display_menu (void);
int
Thread_Bounded_Packet_Relay_Driver::init (void);
{
+ // @@ Chris, I suspect that putting a typedef here may break some
+ // compilers. Can you please move it to outside of the method?
typedef Command<Input_Task, Input_Task::ACTION> CMD;
// initialize the <Command> objects with their corresponding
// methods from <Input_Task>
ACE_NEW_RETURN (packet_count_cmd_,
- CMD (input_task_, &User_Input_Task::set_packet_count),
+ CMD (input_task_,
+ &User_Input_Task::set_packet_count),
-1);
-
ACE_NEW_RETURN (arrival_period_cmd_,
- CMD (input_task_, &User_Input_Task::set_arrival_period),
+ CMD (input_task_,
+ &User_Input_Task::set_arrival_period),
-1);
-
ACE_NEW_RETURN (transmit_period_cmd_,
- CMD (input_task_, &User_Input_Task::set_send_period),
+ CMD (input_task_,
+ &User_Input_Task::set_send_period),
-1);
-
ACE_NEW_RETURN (duration_limit_cmd_,
- CMD (input_task_, &User_Input_Task::set_duration_limit),
+ CMD (input_task_,
+ &User_Input_Task::set_duration_limit),
-1);
-
ACE_NEW_RETURN (logging_level_cmd_,
- CMD (input_task_, &User_Input_Task::set_logging_level),
+ CMD (input_task_,
+ &User_Input_Task::set_logging_level),
-1);
-
ACE_NEW_RETURN (run_transmission_cmd_,
- CMD (input_task_, &User_Input_Task::run_transmission),
+ CMD (input_task_,
+ &User_Input_Task::run_transmission),
-1);
-
ACE_NEW_RETURN (cancel_transmission_cmd_,
- CMD (input_task_, &User_Input_Task::end_transmission),
+ CMD (input_task_,
+ &User_Input_Task::end_transmission),
-1);
-
ACE_NEW_RETURN (report_stats_cmd_,
- CMD (input_task_, &User_Input_Task::report_stats),
+ CMD (input_task_,
+ &User_Input_Task::report_stats),
-1);
-
ACE_NEW_RETURN (shutdown_cmd_,
- CMD (input_task_, &User_Input_Task::shutdown),
+ CMD (input_task_,
+ &User_Input_Task::shutdown),
-1);
-
if (this->input_task_.activate () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "cannot activate input task"), -1);
-
- if (this->timer_queue_.activate () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "cannot activate timer queue"), -1);
-
- if (ACE_Thread_Manager::instance ()->wait () == -1)
- ACE_ERROR_RETURN ((LM_ERROR, "wait on Thread_Manager failed"),-1);
-
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "cannot activate input task"),
+ -1);
+ else if (this->timer_queue_.activate () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "cannot activate timer queue"),
+ -1);
+ else if (ACE_Thread_Manager::instance ()->wait () == -1)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "wait on Thread_Manager failed"),
+ -1);
return 0;
}
// initialize the driver
int
-Thread_Bounded_Packet_Relay_Driver::run (void);
+Thread_Bounded_Packet_Relay_Driver::run (void)
{
this->init ();
return 0;
}
// run the driver
-
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
template class ACE_Thread_Timer_Queue_Adapter<Timer_Heap>;
template class Bounded_Packet_Relay_Driver<Thread_Timer_Queue,
diff --git a/examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.h b/examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.h
index 32bff6f8990..9457c6abe8d 100644
--- a/examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.h
+++ b/examples/Bounded_Packet_Relay/Thread_Bounded_Packet_Relay.h
@@ -1,5 +1,4 @@
/* -*- C++ -*- */
-
// $Id$
// ============================================================================
@@ -11,6 +10,7 @@
// Thread_Bounded_Packet_Relay.h
//
// = DESCRIPTION
+// @@ Chris, please update these comments.
// This code exercises the <ACE_Thread_Timer_Queue_Adapter> using
// an <ACE_Timer_Heap_T>.
//
@@ -48,23 +48,22 @@ class Thread_Bounded_Packet_Relay_Driver;
template <class RECEIVER, class ACTION>
class Command : public Command_Base
+{
// = TITLE
// Defines an abstract class that allows us to invoke commands
// without knowing anything about the implementation. This class
- // is used in the <Bounded_Packet_Relay_Driver> to invoke operations
- // of the driver.
+ // is used in the <Bounded_Packet_Relay_Driver> to invoke
+ // operations of the driver.
//
// = DESCRIPTION
// This class declares an interface to execute operations,
// binding a RECEIVER object with an ACTION. The RECEIVER knows
// how to implement the operation. A class can invoke operations
// without knowing anything about it, or how it was implemented.
-{
public:
-
Command (RECEIVER &recvr, ACTION action);
- // Sets the <receiver_> of the Command to recvr, and the
- // <action_> of the Command to <action>.
+ // Sets the <receiver_> of the Command to recvr, and the <action_>
+ // of the Command to <action>.
virtual int execute (void *arg);
// Invokes the method <action_> from the object <receiver_>.
@@ -77,42 +76,46 @@ private:
// method that is going to be invoked.
};
-
class Text_Input_Device_Wrapper : public Input_Device_Wrapper_Base
+{
// = TITLE
// Defines a wrapper for a simple active looping text input
// pseudo-device.
//
// = DESCRIPTION
- // The wrapper is an active object, running in its own thread, and uses a
- // reactor to generate timeouts. When a timeout occurs, the wrapper
- // calls its concrete message creation method. The wrapper then calls
- // its base class message send method to forward the message to the
- // receiver.
+ // The wrapper is an active object, running in its own thread,
+ // and uses a reactor to generate timeouts. When a timeout
+ // occurs, the wrapper calls its concrete message creation
+ // method. The wrapper then calls its base class message send
+ // method to forward the message to the receiver.
//
- // A more sophisticated version of this class would use the reactive
- // capabilities as well as the timeout generating capabilities of the
- // reactor, multiplexing several input streams. Comments to this
- // effect appear in the definition of the event loop method.
-{
- public:
-
- Text_Input_Device_Wrapper (ACE_Thread_Manager * input_task_mgr, size_t read_length, const char* text);
- // ctor
-
- ~Text_Input_Device_Wrapper ();
+ // A more sophisticated version of this class would use the
+ // reactive capabilities as well as the timeout generating
+ // capabilities of the reactor, multiplexing several input
+ // streams. Comments to this effect appear in the definition of
+ // the event loop method.
+public:
+ // = Initialization and termination methods.
+ Text_Input_Device_Wrapper (ACE_Thread_Manager *input_task_mgr,
+ size_t read_length,
+ const char* text);
+ // @@ Chris, please spell out these names as "constructor" and
+ // "destructor." ctor
+
+ ~Text_Input_Device_Wrapper (void);
// dtor
protected:
-
- virtual ACE_Message_Block *create_input_message ();
- // creates a new message block, carrying data
- // read from the underlying input device
+ virtual ACE_Message_Block *create_input_message (void);
+ // Creates a new message block, carrying data read from the
+ // underlying input device.
private:
-
size_t read_length_;
- // length of the buffer into which to "read"
+ // @@ Chris, make sure that you capitalize the first character of
+ // all comments and that you put a period at the end of each one.
+ // length of the buffer into which to "read". Please do this for
+ // all your comments in *.h files.
const char *text_;
// text to "read" into the buffer
@@ -121,17 +124,15 @@ private:
// index into the string
};
-
class Text_Output_Driver_Wrapper : public Output_Device_Wrapper_Base
+{
// = TITLE
// Implements a simple wrapper for a output pseudo-device.
//
// = DESCRIPTION
// Data from the passed output message is printed to the standard
// output stream, if logging is turned on.
-{
public:
-
Text_Output_Driver_Wrapper (int logging = 0);
// default ctor
@@ -146,12 +147,10 @@ public:
// and does nothing if the pointer is null.
private:
-
int logging_;
// 0 if logging is turned off, non-zero otherwise
};
-
class User_Input_Task : public ACE_Task_Base
{
// = TITLE
@@ -162,7 +161,6 @@ class User_Input_Task : public ACE_Task_Base
// the control of a Timer_Queue, which is dispatched by another
// thread.
public:
-
typedef int (User_Input_Task::*ACTION) (void *);
// trait for command accessible entry points
@@ -179,19 +177,19 @@ public:
// set the number of packets for the next transmission.
int set_arrival_period (void *);
- // sets the input device packet arrival period (usecs)
- // for the next transmission.
+ // sets the input device packet arrival period (usecs) for the next
+ // transmission.
int set_send_period (void *);
- // sets the period between output device sends (usecs)
- // for the next transmission.
+ // sets the period between output device sends (usecs) for the next
+ // transmission.
int set_duration_limit (void *);
// sets a limit on the transmission duration (usecs)
int set_logging_level (void *);
- // sets logging level (0 or 1) for output device
- // for the next transmission
+ // sets logging level (0 or 1) for output device for the next
+ // transmission
int run_transmission (void *);
// runs the next transmission (if one is not in progress)
@@ -200,14 +198,13 @@ public:
// ends the current transmission (if one is in progress)
int report_stats (void *);
- // reports statistics for the previous transmission
- // (if one is not in progress)
+ // reports statistics for the previous transmission (if one is not
+ // in progress)
int shutdown (void *);
// Shutdown task.
private:
-
const int usecs_;
// How many microseconds are in a second.
@@ -237,8 +234,6 @@ private:
};
-
-
class Send_Handler : public ACE_Event_Handler
{
// = TITLE
@@ -268,7 +263,6 @@ public:
// Cancellation hook
private:
-
u_long send_count_;
// Count of the number of messages to send from the
// relay object to the output device object.
@@ -284,7 +278,6 @@ private:
Thread_Timer_Queue &queue_;
// Store a reference to the timer queue, in which we'll re-register
// ourselves if there are still sends to perform
-
};
class Termination_Handler : public ACE_Event_Handler
@@ -311,15 +304,13 @@ public:
// Cancellation hook
private:
-
Bounded_Packet_Relay<ACE_Thread_Mutex> &relay_;
- // Store a reference to the relay object on which to invoke
- // the end transmission call when the timer expires
+ // Store a reference to the relay object on which to invoke the end
+ // transmission call when the timer expires
Thread_Timer_Queue &queue_;
- // Store a reference to the timer queue, which we'll
- // clear of all timers when this one expires.
-
+ // Store a reference to the timer queue, which we'll clear of all
+ // timers when this one expires.
};
class Thread_Bounded_Packet_Relay_Driver : public Bounded_Packet_Relay_Driver <Thread_Timer_Queue>
@@ -334,7 +325,7 @@ class Thread_Bounded_Packet_Relay_Driver : public Bounded_Packet_Relay_Driver <T
// called from the base class to print a menu specific to the
// thread implementation of the timer queue.
public:
-
+ // = Initialization and termination methods.
Thread_Bounded_Packet_Relay_Driver (void);
// ctor
@@ -351,7 +342,6 @@ public:
// run the driver
private:
-
User_Input_Task input_task_;
// Subclassed from ACE_Task.
};
diff --git a/examples/Bounded_Packet_Relay/bpr_thread.cpp b/examples/Bounded_Packet_Relay/bpr_thread.cpp
index dbc01b5e74c..9f145d81c7d 100644
--- a/examples/Bounded_Packet_Relay/bpr_thread.cpp
+++ b/examples/Bounded_Packet_Relay/bpr_thread.cpp
@@ -35,8 +35,9 @@ main (int, char *[])
// Auto ptr ensures that the driver memory is released
// automatically.
THREAD_BOUNDED_PACKET_RELAY_DRIVER *tbprd;
- ACE_NEW_RETURN (tbprd, Thread_Bounded_Packet_Relay_Driver, -1);
-
+ ACE_NEW_RETURN (tbprd,
+ Thread_Bounded_Packet_Relay_Driver,
+ -1);
auto_ptr <THREAD_BOUNDED_PACKET_RELAY_DRIVER> driver (tbprd);
return driver->run ();