summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>2000-07-16 15:43:32 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>2000-07-16 15:43:32 +0000
commit00bafb5b92295c814908dc2bbd9415e64ec5ffdd (patch)
treea5b49d799ba6c851479f56766223bd986c33c1e7
parentb900f764a4a4bac4fc1c7ff1a26a2ad3015c1ca0 (diff)
downloadATCD-00bafb5b92295c814908dc2bbd9415e64ec5ffdd.tar.gz
ChangeLogTag:Sun Jul 16 08:49:44 2000 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
-rw-r--r--ChangeLog21
-rw-r--r--ChangeLogs/ChangeLog-02a21
-rw-r--r--ChangeLogs/ChangeLog-03a21
-rw-r--r--ace/OS.h7
-rw-r--r--ace/OS.i23
-rw-r--r--ace/Process_Manager.cpp52
-rw-r--r--ace/Process_Manager.h14
-rw-r--r--ace/Select_Reactor_Base.h4
-rw-r--r--ace/TTY_IO.cpp109
-rw-r--r--ace/TTY_IO.h9
10 files changed, 185 insertions, 96 deletions
diff --git a/ChangeLog b/ChangeLog
index 05681211aa3..cc9d2bcddaf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,26 @@
Sun Jul 16 08:49:44 2000 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
+ * ace/OS: Added multiplication operators to ACE_Time_Value. Thanks
+ to Tomer Amiaz <Tomer@bandwiz.com> for contributing these.
+
+ * ace/Process_Manager: To fix deadlocks with the Process_Manager
+ on UNIX applied the following fixes:
+
+ Use the notify() capability of the reactor from the signal
+ handler. This allows the signal handler to notify the reactor
+ (over a pipe) that the signal should be processed. This is done
+ completely without MT locks. If
+ ACE_HAS_REACTOR_NOTIFICATION_QUEUE is defined,
+ ACE_Select_Reactor_Notify::notify_queue_lock_ is now made a
+ recursive mutex.
+
+ Thanks to Roger Larsson <larssoro@hotmail.com> for contribution
+ these fixes.
+
+ * ace/TTY_IO: Added additional support for the ACE serial line I/O
+ wrapper facades. Thanks to Martin Stack <mstack@cambertx.com>
+ for contribution this.
+
* ace/Service_Repository.h,
* ace/Service_Object.h,
* ace/Service_Config.h: Added the following aliases:
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index 05681211aa3..cc9d2bcddaf 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,5 +1,26 @@
Sun Jul 16 08:49:44 2000 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
+ * ace/OS: Added multiplication operators to ACE_Time_Value. Thanks
+ to Tomer Amiaz <Tomer@bandwiz.com> for contributing these.
+
+ * ace/Process_Manager: To fix deadlocks with the Process_Manager
+ on UNIX applied the following fixes:
+
+ Use the notify() capability of the reactor from the signal
+ handler. This allows the signal handler to notify the reactor
+ (over a pipe) that the signal should be processed. This is done
+ completely without MT locks. If
+ ACE_HAS_REACTOR_NOTIFICATION_QUEUE is defined,
+ ACE_Select_Reactor_Notify::notify_queue_lock_ is now made a
+ recursive mutex.
+
+ Thanks to Roger Larsson <larssoro@hotmail.com> for contribution
+ these fixes.
+
+ * ace/TTY_IO: Added additional support for the ACE serial line I/O
+ wrapper facades. Thanks to Martin Stack <mstack@cambertx.com>
+ for contribution this.
+
* ace/Service_Repository.h,
* ace/Service_Object.h,
* ace/Service_Config.h: Added the following aliases:
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index 05681211aa3..cc9d2bcddaf 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,5 +1,26 @@
Sun Jul 16 08:49:44 2000 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
+ * ace/OS: Added multiplication operators to ACE_Time_Value. Thanks
+ to Tomer Amiaz <Tomer@bandwiz.com> for contributing these.
+
+ * ace/Process_Manager: To fix deadlocks with the Process_Manager
+ on UNIX applied the following fixes:
+
+ Use the notify() capability of the reactor from the signal
+ handler. This allows the signal handler to notify the reactor
+ (over a pipe) that the signal should be processed. This is done
+ completely without MT locks. If
+ ACE_HAS_REACTOR_NOTIFICATION_QUEUE is defined,
+ ACE_Select_Reactor_Notify::notify_queue_lock_ is now made a
+ recursive mutex.
+
+ Thanks to Roger Larsson <larssoro@hotmail.com> for contribution
+ these fixes.
+
+ * ace/TTY_IO: Added additional support for the ACE serial line I/O
+ wrapper facades. Thanks to Martin Stack <mstack@cambertx.com>
+ for contribution this.
+
* ace/Service_Repository.h,
* ace/Service_Object.h,
* ace/Service_Config.h: Added the following aliases:
diff --git a/ace/OS.h b/ace/OS.h
index ab892cb4e71..c412cda2e26 100644
--- a/ace/OS.h
+++ b/ace/OS.h
@@ -1210,6 +1210,7 @@ ACE_Export ACE_Time_Value operator + (const ACE_Time_Value &tv1,
ACE_Export ACE_Time_Value operator - (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2);
+
// -------------------------------------------------------------------
class ACE_Export ACE_Time_Value
@@ -1312,8 +1313,7 @@ public:
void usec (long usec);
// Set microseconds.
- // = The following are arithmetic methods for operating on
- // Time_Values.
+ // = The following arithmetic methods operate on <Time_Value>s.
void operator += (const ACE_Time_Value &tv);
// Add <tv> to this.
@@ -1321,6 +1321,9 @@ public:
void operator -= (const ACE_Time_Value &tv);
// Subtract <tv> to this.
+ ACE_Time_Value &operator *= (double d);
+ // Multiply the time value by the <d> factor, which must be >= 0.
+
friend ACE_Export ACE_Time_Value operator + (const ACE_Time_Value &tv1,
const ACE_Time_Value &tv2);
// Adds two ACE_Time_Value objects together, returns the sum.
diff --git a/ace/OS.i b/ace/OS.i
index 06fd85847e6..e5d0de722c9 100644
--- a/ace/OS.i
+++ b/ace/OS.i
@@ -227,6 +227,29 @@ ACE_CE_Errno::operator= (int x)
}
#endif /* ACE_HAS_WINCE_BROKEN_ERRNO */
+ACE_INLINE ACE_Time_Value &
+ACE_Time_Value::operator *= (double d)
+{
+ double time = this->sec () * ACE_ONE_SECOND_IN_USECS + this->usec ();
+ time *= d;
+ this->sec ((long)(time / ACE_ONE_SECOND_IN_USECS));
+ this->usec (((long)time) % ACE_ONE_SECOND_IN_USECS);
+
+ return *this;
+}
+
+ACE_INLINE ACE_Time_Value
+operator * (double d, const ACE_Time_Value &tv)
+{
+ return ACE_Time_Value (tv) *= d;
+}
+
+ACE_INLINE ACE_Time_Value
+operator * (const ACE_Time_Value &tv, double d)
+{
+ return ACE_Time_Value (tv) *= d;
+}
+
// Returns the value of the object as a timeval.
ACE_INLINE
diff --git a/ace/Process_Manager.cpp b/ace/Process_Manager.cpp
index a50b98fd8b9..ebb7fe5273b 100644
--- a/ace/Process_Manager.cpp
+++ b/ace/Process_Manager.cpp
@@ -198,26 +198,8 @@ ACE_Process_Manager::open (size_t size,
if (r)
{
ACE_Event_Handler::reactor (r);
-#if !defined(ACE_WIN32) && !defined (ACE_PSOS)
- // (No signals for child-exited on Win32) Assign the
- // Process_Manager a dummy I/O descriptor. Note that even
- // though we open this file "Write Only" we still need to use
- // the ACE_Event_Handler::NULL_MASK when registering this with
- // the ACE_Reactor (see below).
- this->dummy_handle_ = ACE_OS::open (ACE_DEV_NULL,
- O_WRONLY);
- ACE_ASSERT (this->dummy_handle_ != ACE_INVALID_HANDLE);
-#if defined (F_SETFD)
- // Don't want children to inherit the dummy I/O handle!
- ACE_OS::fcntl (this->dummy_handle_, F_SETFD, 1);
-#endif /* F_SETFD */
-
- // Register signal handler object. Note that NULL_MASK is used
- // to keep the ACE_Reactor from calling us back on the
- // "/dev/null" descriptor. NULL_MASK just reserves a "slot" in
- // the Reactor's internal demuxing table, but doesn't cause it
- // to dispatch the event handler directly. Instead, we use the
- // signal handler to do this.
+#if !defined (ACE_WIN32) && !defined (ACE_PSOS)
+ // Register signal handler object.
if (reactor ()->register_handler
(this,
ACE_Event_Handler::NULL_MASK) == -1)
@@ -250,9 +232,6 @@ ACE_Process_Manager::ACE_Process_Manager (size_t size,
process_table_ (0),
max_process_table_size_ (0),
current_count_ (0),
-#if !defined(ACE_WIN32)
- dummy_handle_ (ACE_INVALID_HANDLE),
-#endif // !defined(ACE_WIN32)
default_exit_handler_ (0)
#if defined (ACE_HAS_THREADS)
, lock_ ()
@@ -331,11 +310,6 @@ ACE_Process_Manager::handle_input (ACE_HANDLE)
return 0;
}
-ACE_HANDLE
-ACE_Process_Manager::get_handle (void) const
-{
- return this->dummy_handle_;
-}
#endif /* !ACE_WIN32 */
// On Unix, this routine is called asynchronously when a SIGCHLD is
@@ -387,10 +361,9 @@ ACE_Process_Manager::handle_signal (int,
}
#else /* !ACE_WIN32 */
ACE_UNUSED_ARG (si);
- return reactor ()->ready_ops
- (this->dummy_handle_,
- ACE_Event_Handler::READ_MASK,
- ACE_Reactor::ADD_MASK);
+ return reactor ()->notify
+ (this,
+ ACE_Event_Handler::READ_MASK);
#endif /* !ACE_WIN32 */
}
@@ -426,21 +399,6 @@ ACE_Process_Manager::register_handler (ACE_Event_Handler *eh,
return 0;
}
-int
-ACE_Process_Manager::handle_close (ACE_HANDLE handle,
- ACE_Reactor_Mask)
-{
- ACE_TRACE ("ACE_Process_Manager::handle_close");
- ACE_UNUSED_ARG (handle);
-
-#if !defined (ACE_WIN32)
- ACE_ASSERT (handle == this->dummy_handle_);
-
- ACE_OS::close (dummy_handle_);
-#endif /* ACE_WIN32 */
- return 0;
-}
-
// Create a new process.
pid_t
diff --git a/ace/Process_Manager.h b/ace/Process_Manager.h
index be7685cf2ac..6ce1e5b6702 100644
--- a/ace/Process_Manager.h
+++ b/ace/Process_Manager.h
@@ -300,10 +300,7 @@ protected:
#if !defined(ACE_WIN32)
virtual int handle_input (ACE_HANDLE proc);
- // Collect one (or more, on unix) Process exit status
-
- virtual ACE_HANDLE get_handle (void) const;
- // (unix only) : return dummy handle
+ // Collect one (or more, on unix) process exit status.
#endif // !defined(ACE_WIN32)
virtual int handle_signal (int signum,
@@ -317,10 +314,6 @@ protected:
// On Win32, this routine is called synchronously, and is passed the
// HANDLE of the Process that exited, so we can do all our work here
- virtual int handle_close (ACE_HANDLE handle,
- ACE_Reactor_Mask close_mask);
- // we're being removed from Reactor...on unix, close bogus handle.
-
private:
int resize (size_t);
// Resize the pool of Process_Descriptors.
@@ -363,11 +356,6 @@ private:
size_t current_count_;
// Current number of processes we are managing.
-#if !defined(ACE_WIN32)
- ACE_HANDLE dummy_handle_;
- // Allows SIGCHLD to be handled synchronously.
-#endif
-
ACE_Event_Handler *default_exit_handler_;
// This event handler is used to notify when a process we control
// exits.
diff --git a/ace/Select_Reactor_Base.h b/ace/Select_Reactor_Base.h
index 10da5893a13..4b196cf1c2a 100644
--- a/ace/Select_Reactor_Base.h
+++ b/ace/Select_Reactor_Base.h
@@ -190,8 +190,8 @@ private:
ACE_Unbounded_Queue <ACE_Notification_Buffer *> free_queue_;
// Keeps track of all free buffers.
- ACE_SYNCH_MUTEX notify_queue_lock_;
- // synchronization for handling of queues
+ ACE_SYNCH_RW_MUTEX notify_queue_lock_;
+ // Synchronization for handling of queues.
#endif /* ACE_HAS_REACTOR_NOTIFICATION_QUEUE */
};
diff --git a/ace/TTY_IO.cpp b/ace/TTY_IO.cpp
index 73e033d2675..44e14b8dc23 100644
--- a/ace/TTY_IO.cpp
+++ b/ace/TTY_IO.cpp
@@ -1,8 +1,9 @@
// $Id$
+#define ACE_BUILD_DLL
#include "ace/TTY_IO.h"
-ACE_RCSID(ace, TTY_IO, "$Id$")
+ACE_RCSID(ace, TTY_IO, "TTY_IO.cpp,v 4.18 1999/06/02 21:20:14 nanbor Exp")
// Interface for reading/writing serial device parameters
@@ -36,8 +37,7 @@ ACE_TTY_IO::control (Control_Mode cmd,
// Get default device parameters.
#if defined (TCGETS)
- if (this->ACE_IO_SAP::control (ACE_static_cast (int, TCGETS),
- (void *) &devpar) == -1)
+ if (this->ACE_IO_SAP::control (TCGETS, (void *) &devpar) == -1)
#elif defined (TCGETA)
if (this->ACE_IO_SAP::control (TCGETA, (void *) &devpar) == -1)
#else
@@ -136,12 +136,13 @@ ACE_TTY_IO::control (Control_Mode cmd,
if (arg->parityenb)
{
c_cflag |= PARENB;
- if (ACE_OS::strcmp ((char *) arg->paritymode, "ODD") == 0
- || ACE_OS::strcmp ((char *) arg->paritymode, "odd") == 0)
+ if (ACE_OS::strcmp (arg->paritymode, "ODD") == 0
+ || ACE_OS::strcmp (arg->paritymode, "odd") == 0)
c_cflag |= PARODD;
}
#if defined (CRTSCTS)
- if (arg->ctsenb) /* enable CTS/RTS protocoll */
+ // 6/22/00 MLS add rtsenb to if statement
+ if ((arg->ctsenb)||(arg->rtsenb)) /* enable CTS/RTS protocoll */
c_cflag |= CRTSCTS;
#endif /* CRTSCTS */
#if defined (CREAD)
@@ -149,6 +150,16 @@ ACE_TTY_IO::control (Control_Mode cmd,
c_cflag |= CREAD;
#endif /* CREAD */
+ // 6/22/00 MLS add enable xon/xoff
+#if defined (IXON)
+ if (arg->xinenb) /* enable XON/XOFF output*/
+ c_cflag |= IXON;
+#endif /* IXON */
+#if defined (IXOFF)
+ if (arg->xoutenb) /* enable XON/XOFF input*/
+ c_cflag |= IXOFF;
+#endif /* IXOFF */
+
c_oflag = 0;
c_iflag = IGNPAR | INPCK;
if (arg->databits < 8)
@@ -165,7 +176,7 @@ ACE_TTY_IO::control (Control_Mode cmd,
devpar.c_cc[5] = ivtime_cc5;
#if defined(TCSETS)
- return this->ACE_IO_SAP::control (ACE_static_cast (int, TCSETS),
+ return this->ACE_IO_SAP::control (TCSETS,
(void *) &devpar);
#elif defined(TCSETA)
return this->ACE_IO_SAP::control (TCSETA,
@@ -221,24 +232,34 @@ ACE_TTY_IO::control (Control_Mode cmd,
switch (arg->stopbits)
{
case 1:
- dcb.StopBits = ONESTOPBIT;
- break;
+ dcb.StopBits = ONESTOPBIT;
+ break;
case 2:
- dcb.StopBits = TWOSTOPBITS;
- break;
+ dcb.StopBits = TWOSTOPBITS;
+ break;
default:
return -1;
}
+
+ // 6/22/00 MLS enabled extra paths for win32 parity checking.
if (arg->parityenb)
{
dcb.fParity = TRUE;
- if (ACE_OS::strcmp ((char *) arg->paritymode, "ODD") == 0
- || ACE_OS::strcmp ((char *) arg->paritymode, "odd") == 0)
+ if (ACE_OS::strcmp (arg->paritymode, "ODD") == 0
+ || ACE_OS::strcmp (arg->paritymode, "odd") == 0)
dcb.Parity = ODDPARITY;
- else if (ACE_OS::strcmp ((char *) arg->paritymode, "EVEN") == 0
- || ACE_OS::strcmp ((char *) arg->paritymode, "even") == 0)
+ else if (ACE_OS::strcmp (arg->paritymode, "EVEN") == 0
+ || ACE_OS::strcmp (arg->paritymode, "even") == 0)
dcb.Parity = EVENPARITY;
+ else if (ACE_OS::strcmp (arg->paritymode, "MARK") == 0
+ || ACE_OS::strcmp (arg->paritymode, "mark") == 0)
+ dcb.Parity = MARKPARITY;
+ else if (ACE_OS::strcmp (arg->paritymode, "SPACE") == 0
+ || ACE_OS::strcmp (arg->paritymode, "space") == 0)
+ dcb.Parity = SPACEPARITY;
+ else
+ dcb.Parity = NOPARITY;
}
else
{
@@ -246,25 +267,55 @@ ACE_TTY_IO::control (Control_Mode cmd,
dcb.Parity = NOPARITY;
}
- if (arg->ctsenb) // enable CTS/RTS protocol.
- {
- dcb.fOutxCtsFlow = TRUE;
- dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;
- }
+ if (arg->ctsenb) // enable CTS protocol.
+ dcb.fOutxCtsFlow = TRUE;
else
+ dcb.fOutxCtsFlow = FALSE;
+
+ // 6/22/00 MLS add great flexibility for win32
+ // pulled rts out of ctsenb
+ switch (arg->rtsenb) // enable RTS protocol.
{
- dcb.fOutxCtsFlow = FALSE;
+ case 1:
+ dcb.fRtsControl = RTS_CONTROL_ENABLE;
+ break;
+ case 2:
+ dcb.fRtsControl = RTS_CONTROL_HANDSHAKE;
+ break;
+ case 3:
+ dcb.fRtsControl = RTS_CONTROL_TOGGLE;
+ break;
+ default:
dcb.fRtsControl = RTS_CONTROL_DISABLE;
- }
+ }
+
+ // 6/22/00 MLS add enable xon/xoff
+ if (arg->xinenb) // enable XON/XOFF for reception
+ dcb.fOutX = TRUE;
+ else
+ dcb.fOutX = FALSE;
+
+ if (arg->xoutenb) // enable XON/XOFF for transmission
+ dcb.fOutX = TRUE;
+ else
+ dcb.fOutX = FALSE;
+
+ // always set limits unless set to -1 to use default
+ // 6/22/00 MLS add xon/xoff limits
+ if (arg->xonlim != -1)
+ dcb.XonLim = arg->xonlim;
+ if (arg->xofflim != -1)
+ dcb.XoffLim = arg->xofflim;
+
dcb.fDtrControl = DTR_CONTROL_ENABLE;
dcb.fBinary = TRUE;
- ::SetCommState (this->get_handle (), &dcb);
-
- // 2/13/97 BWF added drop out timer
- COMMTIMEOUTS timeouts;
- ::GetCommTimeouts (this->get_handle(), &timeouts);
- timeouts.ReadIntervalTimeout = arg->readtimeoutmsec;
- return ::SetCommTimeouts (this->get_handle (), &timeouts);
+ ::SetCommState (this->get_handle (), &dcb);
+
+ // 2/13/97 BWF added drop out timer
+ COMMTIMEOUTS timeouts;
+ ::GetCommTimeouts (this->get_handle (), &timeouts);
+ timeouts.ReadIntervalTimeout = arg->readtimeoutmsec;
+ return ::SetCommTimeouts (this->get_handle (), &timeouts);
case GETPARAMS:
ACE_NOTSUP_RETURN (-1); // Not yet implemented.
diff --git a/ace/TTY_IO.h b/ace/TTY_IO.h
index 4c0e768a78d..1353bd0eea1 100644
--- a/ace/TTY_IO.h
+++ b/ace/TTY_IO.h
@@ -12,13 +12,12 @@
// = DESCRIPTION
//
// = AUTHOR
-// Douglas C. Schmidt
+// Douglas C. Schmidt <schmidt@uci.edu>
//
// ============================================================================
#ifndef ACE_TTY_IO_H
#define ACE_TTY_IO_H
-#include "ace/pre.h"
#include "ace/OS.h"
@@ -59,6 +58,11 @@ public:
int readtimeoutmsec;
int ctsenb;
int rcvenb;
+ int rtsenb; // enable & set rts mode (win32)
+ int xinenb; // enable xon/xoff reception
+ int xoutenb; // enable xon/xoff transmission
+ int xonlim; // min bytes in input buffer before xon
+ int xofflim; // max bytes in input buffer before xoff
};
int control (Control_Mode cmd,
@@ -71,5 +75,4 @@ public:
#endif /* ACE_NEEDS_DEV_IO_CONVERSION */
};
-#include "ace/post.h"
#endif /* ACE_TTY_IO_H */