summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ACE-INSTALL.html5
-rw-r--r--ChangeLog-97b52
-rw-r--r--ace/Mem_Map.cpp10
-rw-r--r--ace/Object_Manager.cpp2
-rw-r--r--ace/Service_Object.cpp9
-rw-r--r--ace/Service_Types.cpp17
-rw-r--r--ace/Service_Types.h11
-rw-r--r--ace/Signal.h16
-rw-r--r--ace/Signal.i19
-rw-r--r--ace/Strategies_T.cpp8
-rw-r--r--ace/Svc_Conf.y15
-rw-r--r--ace/Svc_Conf_y.cpp77
-rw-r--r--ace/Timer_Queue_T.cpp28
-rw-r--r--ace/Timer_Queue_T.h18
-rw-r--r--tests/Async_Timer_Queue_Test.cpp79
15 files changed, 254 insertions, 112 deletions
diff --git a/ACE-INSTALL.html b/ACE-INSTALL.html
index 9ac1597c19b..cfed6ac68c9 100644
--- a/ACE-INSTALL.html
+++ b/ACE-INSTALL.html
@@ -403,6 +403,11 @@ the following approach:
at the root of the ACE source tree. This will build the static and
shared object libraries and build the tests and the sample
applications. <P>
+
+<LI> If you need to regenerate the Svc_Conf_y.cpp file, you'll need to
+get <A HREF="http://www.cs.wustl.edu/~schmidt/byacc.tar.gz">Berkeley
+YACC</A>. However, you should rarely, if ever, need to do this. <P>
+
</OL>
<P><HR><P>
diff --git a/ChangeLog-97b b/ChangeLog-97b
index 83e014a1db0..cb700402aed 100644
--- a/ChangeLog-97b
+++ b/ChangeLog-97b
@@ -1,3 +1,55 @@
+Sat Sep 13 12:11:50 1997 Douglas C. Schmidt <schmidt@flamenco.cs.wustl.edu>
+
+ * ace/Timer_Queue_T.cpp (schedule): Oops, must pass &this->mask_
+ to ACE_Sig_Set rather than this->mask_.
+
+ * ace/Object_Manager.cpp: Changed #include
+ "ace/Service_Repository.h" to #include "ace/Service_Config.h"
+ since we now call ACE_Service_Config::close().
+
+ * ace/Service_Types: Removed a nasty circular dependency by simply
+ having each of the ACE_Service_Type_Impl subclasses take const
+ void *'s rather than their specific type (i.e., ACE_Stream or
+ ACE_Module, etc.). This turns out not to be a problem since we
+ treated them as const void *'s internally anyhow...
+
+ * ace/Strategies_T.cpp: Fixed a bug in ACE_DLL_Strategy:
+
+ ACE_Service_Type_Impl stp = new ACE_Service_Object_Type (svc_handler, this->svc_name_);
+
+ should be
+
+ ACE_Service_Type_Impl *stp = new ACE_Service_Object_Type (svc_handler, this->svc_name_)
+
+ I wonder how this ever compiled?!
+
+Fri Sep 12 13:26:50 1997 Douglas C. Schmidt <schmidt@tango.cs.wustl.edu>
+
+ * ace/Mem_Map.cpp (close): Removed the following code in the
+ close() method that appears to be redundant with the code in
+ unmap():
+
+ if (this->file_mapping_ != this->handle_
+ && this->file_mapping_ != ACE_INVALID_HANDLE)
+ ACE_OS::close (this->file_mapping_);
+
+ Also cleaned up the close() code so that it doesn't try to close
+ the handle multiple times, even if close() is called more than
+ once. Thanks to Beged-Dov <begeddov@proaxis.com> for reporting
+ this.
+
+ * tests/Async_Timer_Queue_Test.cpp: Improved the structure of the
+ program and finished implementing the new feature that makes it
+ possible to avoid blocking SIGQUIT.
+
+ * ace/Timer_Queue_T: Added support for an ACE_Sig_Set that can be
+ passed into the constructor of ACE_Async_Timer_Queue_Adapter.
+ This will enable us to selectively block only certain signals.
+
+ * ace/Signal: Added a new constructor for ACE_Sig_Set that takes
+ ACE_Sig_Set * and also improved the documentation of the
+ constructor interfaces.
+
Fri Sep 12 13:46:04 1997 David L. Levine <levine@cs.wustl.edu>
* ace/OS.[hi],Log_Msg.h,config-lynxos.h,
diff --git a/ace/Mem_Map.cpp b/ace/Mem_Map.cpp
index b2b11ac203b..db77c013710 100644
--- a/ace/Mem_Map.cpp
+++ b/ace/Mem_Map.cpp
@@ -34,13 +34,11 @@ ACE_Mem_Map::close (void)
this->unmap ();
- if (this->file_mapping_ != this->handle_
- && this->file_mapping_ != ACE_INVALID_HANDLE)
- ACE_OS::close (this->file_mapping_);
-
if (this->close_handle_)
- return ACE_OS::close (this->handle_);
-
+ {
+ this->close_handle_ = 0;
+ return ACE_OS::close (this->handle_);
+ }
return 0;
}
diff --git a/ace/Object_Manager.cpp b/ace/Object_Manager.cpp
index 6b57002667d..6011dd84352 100644
--- a/ace/Object_Manager.cpp
+++ b/ace/Object_Manager.cpp
@@ -4,7 +4,7 @@
#include "ace/Object_Manager.h"
#include "ace/Containers.h"
-#include "ace/Service_Repository.h"
+#include "ace/Service_Config.h"
#include "ace/Log_Msg.h"
#include "ace/Synch.h"
diff --git a/ace/Service_Object.cpp b/ace/Service_Object.cpp
index 324158145e9..7484cbf5813 100644
--- a/ace/Service_Object.cpp
+++ b/ace/Service_Object.cpp
@@ -3,15 +3,14 @@
// Service_Object.cpp
#define ACE_BUILD_DLL
-#include "ace/Service_Object.h"
#include "ace/Service_Types.h"
+#include "ace/Service_Object.h"
#if !defined (__ACE_INLINE__)
#include "ace/Service_Object.i"
#endif /* __ACE_INLINE__ */
ACE_ALLOC_HOOK_DEFINE(ACE_Service_Object)
-
ACE_ALLOC_HOOK_DEFINE(ACE_Service_Type)
void
@@ -21,9 +20,9 @@ ACE_Service_Type::dump (void) const
}
ACE_Service_Type::ACE_Service_Type (const char *n,
- ACE_Service_Type_Impl *t,
- const ACE_SHLIB_HANDLE h,
- int active)
+ ACE_Service_Type_Impl *t,
+ const ACE_SHLIB_HANDLE h,
+ int active)
: name_ (0),
type_ (t),
handle_ (h),
diff --git a/ace/Service_Types.cpp b/ace/Service_Types.cpp
index 4b8c0719734..04b7b380592 100644
--- a/ace/Service_Types.cpp
+++ b/ace/Service_Types.cpp
@@ -4,6 +4,11 @@
#define ACE_BUILD_DLL
#include "ace/Service_Types.h"
#include "ace/Stream_Modules.h"
+#include "ace/Stream.h"
+
+typedef ACE_Stream<ACE_SYNCH> MT_Stream;
+typedef ACE_Module<ACE_SYNCH> MT_Module;
+typedef ACE_Task<ACE_SYNCH> MT_Task;
#if !defined (__ACE_INLINE__)
#include "ace/Service_Types.i"
@@ -56,10 +61,10 @@ ACE_Service_Type_Impl::fini (void) const
return 0;
}
-ACE_Service_Object_Type::ACE_Service_Object_Type (ACE_Service_Object *so,
+ACE_Service_Object_Type::ACE_Service_Object_Type (const void *so,
const char *s_name,
unsigned int f)
- : ACE_Service_Type_Impl ((const void *) so, s_name, f)
+ : ACE_Service_Type_Impl (so, s_name, f)
{
ACE_TRACE ("ACE_Service_Object_Type::ACE_Service_Object_Type");
}
@@ -85,10 +90,10 @@ ACE_Module_Type::dump (void) const
ACE_TRACE ("ACE_Module_Type::dump");
}
-ACE_Module_Type::ACE_Module_Type (MT_Module *m,
+ACE_Module_Type::ACE_Module_Type (const void *m,
const char *m_name,
u_int f)
- : ACE_Service_Type_Impl ((const void *) m, m_name, f)
+ : ACE_Service_Type_Impl (m, m_name, f)
{
ACE_TRACE ("ACE_Module_Type::ACE_Module_Type");
}
@@ -229,10 +234,10 @@ ACE_Stream_Type::resume (void) const
return 0;
}
-ACE_Stream_Type::ACE_Stream_Type (MT_Stream *s,
+ACE_Stream_Type::ACE_Stream_Type (const void *s,
const char *s_name,
unsigned int f)
- : ACE_Service_Type_Impl ((const void *) s, s_name, f),
+ : ACE_Service_Type_Impl (s, s_name, f),
head_ (0)
{
ACE_TRACE ("ACE_Stream_Type::ACE_Stream_Type");
diff --git a/ace/Service_Types.h b/ace/Service_Types.h
index 501c4e010c8..2b5255d0687 100644
--- a/ace/Service_Types.h
+++ b/ace/Service_Types.h
@@ -19,11 +19,6 @@
#include "ace/Service_Object.h"
#include "ace/Synch.h"
-#include "ace/Stream.h"
-
-typedef ACE_Stream<ACE_SYNCH> MT_Stream;
-typedef ACE_Module<ACE_SYNCH> MT_Module;
-typedef ACE_Task<ACE_SYNCH> MT_Task;
class ACE_Export ACE_Service_Type_Impl
// = TITLE
@@ -86,7 +81,7 @@ class ACE_Export ACE_Service_Object_Type : public ACE_Service_Type_Impl
{
public:
// = Initialization method.
- ACE_Service_Object_Type (ACE_Service_Object *so,
+ ACE_Service_Object_Type (const void *so,
const char *name,
u_int flags = 0);
@@ -105,7 +100,7 @@ class ACE_Export ACE_Module_Type : public ACE_Service_Type_Impl
{
public:
// = Initialization method.
- ACE_Module_Type (MT_Module *m,
+ ACE_Module_Type (const void *m, // Really an <ACE_Module> *.
const char *identifier,
u_int flags = 0);
@@ -138,7 +133,7 @@ class ACE_Export ACE_Stream_Type : public ACE_Service_Type_Impl
{
public:
// = Initialization method.
- ACE_Stream_Type (MT_Stream *s,
+ ACE_Stream_Type (const void *s, // Really an <ACE_Stream> *.
const char *identifier,
u_int flags = 0);
diff --git a/ace/Signal.h b/ace/Signal.h
index 7c851869eea..30d9add0700 100644
--- a/ace/Signal.h
+++ b/ace/Signal.h
@@ -34,8 +34,17 @@ class ACE_Export ACE_Sig_Set
{
public:
// = Initialization and termination methods.
- ACE_Sig_Set (sigset_t *);
+ ACE_Sig_Set (sigset_t *sigset);
+ // Initialize <sigset_> with <sigset>. If <sigset> == 0 then fill
+ // the set.
+
+ ACE_Sig_Set (ACE_Sig_Set *sigset);
+ // Initialize <sigset_> with <sigset>. If <sigset> == 0 then fill
+ // the set.
+
ACE_Sig_Set (int fill = 0);
+ // If <fill> == 0 then initialize the <sigset_> empty, else full.
+
~ACE_Sig_Set (void);
int empty_set (void);
@@ -141,9 +150,12 @@ class ACE_Export ACE_Sig_Guard
// Note that a "0" for mask causes all signals to be held.
{
public:
- // = Set/remove mask.
+ // = Initialization and termination methods.
ACE_Sig_Guard (ACE_Sig_Set *mask = 0);
+ // Block out signals in <mask>. Default is to block all signals!
+
~ACE_Sig_Guard (void);
+ // Restore blocked signals.
void dump (void) const;
// Dump the state of an object.
diff --git a/ace/Signal.i b/ace/Signal.i
index b14818db0ff..1cb775cce87 100644
--- a/ace/Signal.i
+++ b/ace/Signal.i
@@ -5,15 +5,21 @@
ACE_INLINE
ACE_Sig_Set::ACE_Sig_Set (sigset_t *ss)
- : sigset_ (*ss) // Structure assignment
{
ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set");
+
+ if (ss == 0)
+ ACE_OS::sigfillset (&this->sigset_);
+ else
+ // Structure assignment.
+ this->sigset_ = *ss;
}
ACE_INLINE
ACE_Sig_Set::ACE_Sig_Set (int fill)
{
ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set");
+
if (fill)
ACE_OS::sigfillset (&this->sigset_);
else
@@ -21,6 +27,17 @@ ACE_Sig_Set::ACE_Sig_Set (int fill)
}
ACE_INLINE
+ACE_Sig_Set::ACE_Sig_Set (ACE_Sig_Set *ss)
+{
+ ACE_TRACE ("ACE_Sig_Set::ACE_Sig_Set");
+
+ if (ss == 0)
+ ACE_OS::sigfillset (&this->sigset_);
+ else
+ this->sigset_ = ss->sigset_;
+}
+
+ACE_INLINE
ACE_Sig_Set::~ACE_Sig_Set (void)
{
ACE_TRACE ("ACE_Sig_Set::~ACE_Sig_Set");
diff --git a/ace/Strategies_T.cpp b/ace/Strategies_T.cpp
index ccca4fb1266..963813cef7a 100644
--- a/ace/Strategies_T.cpp
+++ b/ace/Strategies_T.cpp
@@ -150,12 +150,14 @@ template <class SVC_HANDLER> int
ACE_DLL_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh)
{
ACE_TRACE ("ACE_DLL_Strategy<SVC_HANDLER>::make_svc_handler");
+
// Open the shared library.
ACE_SHLIB_HANDLE handle = ACE_OS::dlopen (this->shared_library_);
// Extract the factory function.
- SVC_HANDLER *(*factory)(void) = (SVC_HANDLER *(*)(void)) ACE_OS::dlsym
- (handle, this->factory_function_);
+ SVC_HANDLER *(*factory)(void) =
+ (SVC_HANDLER *(*)(void)) ACE_OS::dlsym (handle,
+ this->factory_function_);
// Call the factory function to obtain the new SVC_Handler (should
// use RTTI here when it becomes available...)
@@ -168,7 +170,7 @@ ACE_DLL_Strategy<SVC_HANDLER>::make_svc_handler (SVC_HANDLER *&sh)
// Create an ACE_Service_Type containing the SVC_Handler and
// insert into this->svc_rep_;
- ACE_Service_Type_Impl stp =
+ ACE_Service_Type_Impl *stp =
new ACE_Service_Object_Type (svc_handler, this->svc_name_);
if (stp == 0)
diff --git a/ace/Svc_Conf.y b/ace/Svc_Conf.y
index d29021c2274..ad457e8bc50 100644
--- a/ace/Svc_Conf.y
+++ b/ace/Svc_Conf.y
@@ -184,7 +184,8 @@ svc_location
: ACE_IDENT type svc_initializer status
{
u_int flags
- = ACE_Service_Type_Impl::DELETE_THIS | ($3->dispose () == 0 ? 0 : ACE_Service_Type_Impl::DELETE_OBJ);
+ = ACE_Service_Type::DELETE_THIS
+ | ($3->dispose () == 0 ? 0 : ACE_Service_Type::DELETE_OBJ);
const void *sym = $3->symbol ();
if (sym != 0)
@@ -317,13 +318,19 @@ ace_create_service_type (const char *name,
switch (type)
{
case ACE_SVC_OBJ_T:
- stp = new ACE_Service_Object_Type ((ACE_Service_Object *) symbol, name, flags);
+ ACE_NEW_RETURN (stp,
+ ACE_Service_Object_Type ((ACE_Service_Object *) symbol, name, flags),
+ 0);
break;
case ACE_MODULE_T:
- stp = new ACE_Module_Type ((MT_Module *) symbol, name, flags);
+ ACE_NEW_RETURN (stp,
+ ACE_Module_Type (symbol, name, flags),
+ 0);
break;
case ACE_STREAM_T:
- stp = new ACE_Stream_Type ((MT_Stream *) symbol, name, flags);
+ ACE_NEW_RETURN (stp,
+ ACE_Stream_Type (symbol, name, flags),
+ 0);
break;
default:
ACE_ERROR ((LM_ERROR, "unknown case\n"));
diff --git a/ace/Svc_Conf_y.cpp b/ace/Svc_Conf_y.cpp
index bd4fb9e9370..91ad9e54d93 100644
--- a/ace/Svc_Conf_y.cpp
+++ b/ace/Svc_Conf_y.cpp
@@ -1,5 +1,3 @@
-// $Id$
-
#ifndef lint
char ace_yysccsid[] = "@(#)yaccpar 1.4 (Berkeley) 02/25/90 \n\
Modified 5/2/90 by J. Roskind to support graphic debugging modes";
@@ -241,7 +239,7 @@ YYSTYPE ace_yylval;
#define ace_yystacksize YYSTACKSIZE
short ace_yyss[YYSTACKSIZE];
YYSTYPE ace_yyvs[YYSTACKSIZE];
-#line 264 "Svc_Conf.y"
+#line 257 "Svc_Conf.y"
// Prints the error string to standard output. Cleans up the error
// messages.
@@ -306,13 +304,19 @@ ace_create_service_type (const char *name,
switch (type)
{
case ACE_SVC_OBJ_T:
- stp = new ACE_Service_Object_Type ((ACE_Service_Object *) symbol, name, flags);
+ ACE_NEW_RETURN (stp,
+ ACE_Service_Object_Type ((ACE_Service_Object *) symbol, name, flags),
+ 0);
break;
case ACE_MODULE_T:
- stp = new ACE_Module_Type ((MT_Module *) symbol, name, flags);
+ ACE_NEW_RETURN (stp,
+ ACE_Module_Type (symbol, name, flags),
+ 0);
break;
case ACE_STREAM_T:
- stp = new ACE_Stream_Type ((MT_Stream *) symbol, name, flags);
+ ACE_NEW_RETURN (stp,
+ ACE_Stream_Type (symbol, name, flags),
+ 0);
break;
default:
ACE_ERROR ((LM_ERROR, "unknown case\n"));
@@ -344,7 +348,7 @@ main (int argc, char *argv[])
return ace_yyparse ();
}
#endif /* DEBUGGING */
-#line 346 "Svc_Conf_y.cpp"
+#line 352 "Svc_Conf_y.cpp"
#define YYABORT goto ace_yyabort
#define YYACCEPT goto ace_yyaccept
#define YYERROR goto ace_yyerrlab
@@ -372,7 +376,7 @@ int ace_yyindent;
#endif /* YYDEBUG_INDENT */
#ifndef YYDEBUG_REDUCE
#ifdef __cplusplus
-void YYDEBUG_REDUCE(int /* ace_yynew_state */, int /* ace_yyrule_num */, char *ace_yyrule_string, int ace_yynew_indent, int ace_yyrhs_count)
+void YYDEBUG_REDUCE(int ace_yynew_state, int ace_yyrule_num, char *ace_yyrule_string, int ace_yynew_indent, int ace_yyrhs_count)
#else
YYDEBUG_REDUCE(ace_yynew_state, ace_yyrule_num, ace_yyrule_string, ace_yynew_indent, ace_yyrhs_count)
int ace_yynew_state;
@@ -402,7 +406,7 @@ int ace_yyrhs_count;
#endif /* YYDEBUG_REDUCE */
#ifndef YYDEBUG_SHIFT_LEXEME
#ifdef __cplusplus
-void YYDEBUG_SHIFT_LEXEME(int /* ace_yyold_state */, int /* ace_yynew_state */, char *ace_yytoken_string, int ace_yynew_indent)
+void YYDEBUG_SHIFT_LEXEME(int ace_yyold_state, int ace_yynew_state, char *ace_yytoken_string, int ace_yynew_indent)
#else
YYDEBUG_SHIFT_LEXEME(ace_yyold_state, ace_yynew_state, ace_yytoken_string, ace_yynew_indent)
int ace_yyold_state;
@@ -417,7 +421,7 @@ int ace_yynew_indent;
#endif /* YYDEBUG_SHIFT_LEXEME */
#ifndef YYDEBUG_LOOK_AHEAD
#ifdef __cplusplus
-void YYDEBUG_LOOK_AHEAD(int /* ace_yynew_state */, int ace_yytoken_num, char *ace_yytoken_string, int ace_yyindent)
+void YYDEBUG_LOOK_AHEAD(int ace_yynew_state, int ace_yytoken_num, char *ace_yytoken_string, int ace_yyindent)
#else
YYDEBUG_LOOK_AHEAD(ace_yynew_state, ace_yytoken_num, ace_yytoken_string, ace_yyindent)
int ace_yynew_state;
@@ -434,7 +438,7 @@ int ace_yyindent;
#endif /* YYDEBUG_LOOK_AHEAD */
#ifndef YYDEBUG_DISCARD_STATE
#ifdef __cplusplus
-void YYDEBUG_DISCARD_STATE(int /* ace_yynew_state */, int ace_yyindent)
+void YYDEBUG_DISCARD_STATE(int ace_yynew_state, int ace_yyindent)
#else
YYDEBUG_DISCARD_STATE(ace_yynew_state, ace_yyindent)
int ace_yynew_state;
@@ -462,7 +466,7 @@ int ace_yyindent;
#endif /* YYDEBUG_DISCARD_STATE */
#ifndef YYDEBUG_DISCARD_TOKEN
#ifdef __cplusplus
-void YYDEBUG_DISCARD_TOKEN(int /* ace_yynew_state */, int /* ace_yytoken_num */, char *ace_yytoken_string, int ace_yyindent)
+void YYDEBUG_DISCARD_TOKEN(int ace_yynew_state, int ace_yytoken_num, char *ace_yytoken_string, int ace_yyindent)
#else
YYDEBUG_DISCARD_TOKEN(ace_yynew_state, ace_yytoken_num, ace_yytoken_string, ace_yyindent)
int ace_yynew_state;
@@ -477,7 +481,7 @@ int ace_yyindent;
#endif /* YYDEBUG_DISCARD_TOKEN */
#ifndef YYDEBUG_SHIFT_ERROR_LEXEME
#ifdef __cplusplus
-void YYDEBUG_SHIFT_ERROR_LEXEME(int /* ace_yyold_state */, int /* ace_yynew_state */, int ace_yyindent)
+void YYDEBUG_SHIFT_ERROR_LEXEME(int ace_yyold_state, int ace_yynew_state, int ace_yyindent)
#else
YYDEBUG_SHIFT_ERROR_LEXEME(ace_yyold_state, ace_yynew_state, ace_yyindent)
int ace_yyold_state;
@@ -503,7 +507,7 @@ ace_yyparse()
extern char *ace_foo();
#endif
- if ((ace_yys = ACE_OS::getenv("YYDEBUG")))
+ if (ace_yys = ACE_OS::getenv("YYDEBUG"))
{
ace_yyn = *ace_yys;
if (ace_yyn >= '0' && ace_yyn <= '9')
@@ -520,7 +524,7 @@ ace_yyparse()
*ace_yyssp = ace_yystate = 0;
ace_yyloop:
- if ((ace_yyn = ace_yydefred[ace_yystate])) goto ace_yyreduce;
+ if (ace_yyn = ace_yydefred[ace_yystate]) goto ace_yyreduce;
if (ace_yychar < 0)
{
if ((ace_yychar = ace_yylex()) < 0) ace_yychar = 0;
@@ -756,11 +760,6 @@ case 25:
ACE_ARGV args (ace_yyvsp[0].static_node_->parameters ());
ACE_Module_Type *mt = get_module (ace_yyvsp[-2].static_node_, ace_yyvsp[0].static_node_);
- if (::strcmp (ace_yyvsp[0].static_node_->name (),
- ((MT_Module *) mt->object ())->name ()) != 0)
- ACE_ERROR ((LM_ERROR, "warning, service name %s is different from Module name %s\n",
- ace_yyvsp[0].static_node_->name (), ((MT_Module *) mt->object ())->name ()));
-
if (mt->init (args.argc (), args.argv ()) == -1
|| ((ACE_Stream_Type *) (ace_yyvsp[-2].static_node_)->record ()->type ())->push (mt) == -1)
{
@@ -771,19 +770,16 @@ case 25:
}
break;
case 26:
-#line 157 "Svc_Conf.y"
+#line 152 "Svc_Conf.y"
{
ACE_Module_Type *mt = get_module (ace_yyvsp[-2].static_node_, ace_yyvsp[0].static_node_->name ());
- if (::strcmp (ace_yyvsp[0].static_node_->name (),
- ((MT_Module *) mt->object ())->name ()) != 0)
- ACE_ERROR ((LM_ERROR, "warning, service name %s is different from Module name %s\n",
- ace_yyvsp[0].static_node_->name (), ((MT_Module *) mt->object ())->name ()));
+
if (((ACE_Stream_Type *) (ace_yyvsp[-2].static_node_)->record ()->type ())->push (mt) == -1)
ace_yyerrno++;
}
break;
case 27:
-#line 167 "Svc_Conf.y"
+#line 159 "Svc_Conf.y"
{
ACE_Module_Type *mt = get_module (ace_yyvsp[-2].static_node_, ace_yyvsp[0].static_node_->name ());
if (mt != 0)
@@ -791,7 +787,7 @@ case 27:
}
break;
case 28:
-#line 173 "Svc_Conf.y"
+#line 165 "Svc_Conf.y"
{
ACE_Module_Type *mt = get_module (ace_yyvsp[-2].static_node_, ace_yyvsp[0].static_node_->name ());
if (mt != 0)
@@ -799,7 +795,7 @@ case 28:
}
break;
case 29:
-#line 179 "Svc_Conf.y"
+#line 171 "Svc_Conf.y"
{
ACE_Module_Type *mt = get_module (ace_yyvsp[-2].static_node_, ace_yyvsp[0].static_node_->name ());
if (mt != 0
@@ -812,10 +808,11 @@ case 29:
}
break;
case 30:
-#line 193 "Svc_Conf.y"
+#line 185 "Svc_Conf.y"
{
u_int flags
- = ACE_Service_Type::DELETE_THIS | (ace_yyvsp[-1].location_node_->dispose () == 0 ? 0 : ACE_Service_Type::DELETE_OBJ);
+ = ACE_Service_Type::DELETE_THIS
+ | (ace_yyvsp[-1].location_node_->dispose () == 0 ? 0 : ACE_Service_Type::DELETE_OBJ);
const void *sym = ace_yyvsp[-1].location_node_->symbol ();
if (sym != 0)
@@ -832,58 +829,58 @@ case 30:
}
break;
case 31:
-#line 214 "Svc_Conf.y"
+#line 207 "Svc_Conf.y"
{
ace_yyval.type_ = 1;
}
break;
case 32:
-#line 218 "Svc_Conf.y"
+#line 211 "Svc_Conf.y"
{
ace_yyval.type_ = 0;
}
break;
case 33:
-#line 222 "Svc_Conf.y"
+#line 215 "Svc_Conf.y"
{
ace_yyval.type_ = 1;
}
break;
case 34:
-#line 229 "Svc_Conf.y"
+#line 222 "Svc_Conf.y"
{
ace_yyval.location_node_ = new ACE_Object_Node (ace_yyvsp[-2].ident_, ace_yyvsp[0].ident_);
}
break;
case 35:
-#line 233 "Svc_Conf.y"
+#line 226 "Svc_Conf.y"
{
ace_yyval.location_node_ = new ACE_Function_Node (ace_yyvsp[-4].ident_, ace_yyvsp[-2].ident_);
}
break;
case 36:
-#line 240 "Svc_Conf.y"
+#line 233 "Svc_Conf.y"
{
ace_yyval.type_ = ACE_MODULE_T;
}
break;
case 37:
-#line 244 "Svc_Conf.y"
+#line 237 "Svc_Conf.y"
{
ace_yyval.type_ = ACE_SVC_OBJ_T;
}
break;
case 38:
-#line 248 "Svc_Conf.y"
+#line 241 "Svc_Conf.y"
{
ace_yyval.type_ = ACE_STREAM_T;
}
break;
case 40:
-#line 255 "Svc_Conf.y"
+#line 248 "Svc_Conf.y"
{ ace_yyval.ident_ = 0; }
break;
-#line 884 "Svc_Conf_y.cpp"
+#line 883 "Svc_Conf_y.cpp"
}
ace_yyssp -= ace_yym;
ace_yystate = *ace_yyssp;
diff --git a/ace/Timer_Queue_T.cpp b/ace/Timer_Queue_T.cpp
index 039222edb2c..1c5e3babf02 100644
--- a/ace/Timer_Queue_T.cpp
+++ b/ace/Timer_Queue_T.cpp
@@ -290,8 +290,8 @@ template <class TQ> int
ACE_Async_Timer_Queue_Adapter<TQ>::cancel (long timer_id,
const void **act)
{
- // Block all signals.
- ACE_Sig_Guard sg;
+ // Block designated signals.
+ ACE_Sig_Guard sg (&this->mask_);
ACE_UNUSED_ARG (sg);
return this->timer_queue_.cancel (timer_id, act);
@@ -299,15 +299,15 @@ ACE_Async_Timer_Queue_Adapter<TQ>::cancel (long timer_id,
template <class TQ> long
ACE_Async_Timer_Queue_Adapter<TQ>::schedule (ACE_Event_Handler *eh,
- const void *act,
- const ACE_Time_Value &delay,
- const ACE_Time_Value &interval)
+ const void *act,
+ const ACE_Time_Value &delay,
+ const ACE_Time_Value &interval)
{
ACE_UNUSED_ARG (act);
ACE_UNUSED_ARG (interval);
- // Block all signals.
- ACE_Sig_Guard sg;
+ // Block designated signals.
+ ACE_Sig_Guard sg (&this->mask_);
ACE_UNUSED_ARG (sg);
long tid = this->timer_queue_.schedule (eh, 0, delay);
@@ -327,23 +327,25 @@ ACE_Async_Timer_Queue_Adapter<TQ>::schedule (ACE_Event_Handler *eh,
if (tv < ACE_Time_Value::zero)
tv = ACE_Time_Value (0, 1);
+ // @@ This code should be clever enough to avoid updating the
+ // ualarm() if we haven't actually changed the earliest time.
// Schedule a new timer.
ACE_OS::ualarm (tv);
return 0;
}
template <class TQ>
-ACE_Async_Timer_Queue_Adapter<TQ>::ACE_Async_Timer_Queue_Adapter (void)
+ACE_Async_Timer_Queue_Adapter<TQ>::ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *mask)
+ // If <mask> == 0, block *all* signals when the SIGARLM handler is
+ // running, else just block those in the mask.
+ : mask_ (mask)
{
// The following code is necessary to selectively "block" all
// signals when SIGALRM is running. Also, we always restart system
// calls that are interrupted by the signals.
- // Block *all* signals when the SIGARLM handler is running!
- ACE_Sig_Set ss (1);
-
ACE_Sig_Action sa ((ACE_SignalHandler) 0,
- ss,
+ this->mask_,
SA_RESTART);
if (this->sig_handler_.register_handler (SIGALRM, this, &sa) == -1)
@@ -376,6 +378,8 @@ ACE_Async_Timer_Queue_Adapter<TQ>::handle_signal (int signum,
expired_timers));
// Only schedule a new timer if there is one in the list.
+ // @@ This code should also become smarter to avoid
+ // unnecessary calls to ualarm().
if (this->timer_queue_.is_empty () == 0)
ACE_OS::ualarm (this->timer_queue_.earliest_time ()
- ACE_OS::gettimeofday ());
diff --git a/ace/Timer_Queue_T.h b/ace/Timer_Queue_T.h
index 4b2b4321cd7..132e44cb020 100644
--- a/ace/Timer_Queue_T.h
+++ b/ace/Timer_Queue_T.h
@@ -363,8 +363,10 @@ class ACE_Async_Timer_Queue_Adapter : public ACE_Event_Handler
public:
typedef TQ TIMER_QUEUE;
- ACE_Async_Timer_Queue_Adapter (void);
- // Register the SIGALRM handler.
+ ACE_Async_Timer_Queue_Adapter (ACE_Sig_Set *mask = 0);
+ // Register the SIGALRM handler. If <mask> == 0 then block all
+ // signals when <SIGALRM> is run. Otherwise, just block the signals
+ // indicated in <mask>.
long schedule (ACE_Event_Handler *type,
const void *act,
@@ -374,23 +376,27 @@ public:
// <ACE_Timer_List>. However, this timer gets dispatched via a
// signal, rather than by a user calling <expire>.
- int cancel (long timer_id, const void **);
- // Cancel the <timer_id>.
+ int cancel (long timer_id, const void **act = 0);
+ // Cancel the <timer_id> and pass back the <act> if an address is
+ // passed in.
TQ &timer_queue (void);
// Access the underlying <TIMER_QUEUE>.
private:
virtual int handle_signal (int signum, siginfo_t *, ucontext_t *);
- // Called back by SIGALRM handler.
+ // Called back by <SIGALRM> handler.
ACE_Sig_Handler sig_handler_;
- // Handler for the SIGALRM signal, so that we can access our state
+ // Handler for the <SIGALRM> signal, so that we can access our state
// without requiring global variables.
TQ timer_queue_;
// Implementation of the timer queue (e.g., <ACE_Timer_List>,
// <ACE_Timer_Heap>, etc.).
+
+ ACE_Sig_Set mask_;
+ // Mask of signals to be blocked when we're servicing <SIGALRM>.
};
#if defined (__ACE_INLINE__)
diff --git a/tests/Async_Timer_Queue_Test.cpp b/tests/Async_Timer_Queue_Test.cpp
index 305a72d5bf7..340bff8aade 100644
--- a/tests/Async_Timer_Queue_Test.cpp
+++ b/tests/Async_Timer_Queue_Test.cpp
@@ -45,12 +45,60 @@ Timer_Handler::handle_timeout (const ACE_Time_Value &tv,
}
// Create a helpful typedef.
-typedef ACE_Async_Timer_Queue_Adapter<ACE_Timer_List> ASYNC_TIMER_LIST;
-typedef ACE_Timer_List_Iterator TIMER_LIST_ITERATOR;
+class Async_Timer_Queue : public ACE_Async_Timer_Queue_Adapter<ACE_Timer_List>
+ // = TITLE
+ // Asynchronous Timer Queue Singleton, instantiated by an <ACE_Timer_List>.
+{
+public:
+ static Async_Timer_Queue *instance (void);
+ // Singleton access point.
-// Static instance, instantiated by an <ACE_Timer_List>.
+ void dump (void);
+ // Dump the contents of the queue.
+
+private:
+ Async_Timer_Queue (void);
+ // Private constructor enforces the Singleton.
+
+ static Async_Timer_Queue *instance_;
+ // Pointer to the timer queue.
+};
-ASYNC_TIMER_LIST timer_queue;
+// Initialize the Singleton pointer.
+Async_Timer_Queue *Async_Timer_Queue::instance_ = 0;
+
+// Implement the Singleton logic.
+Async_Timer_Queue *
+Async_Timer_Queue::instance (void)
+{
+ if (Async_Timer_Queue::instance_ == 0)
+ {
+ // Initialize with all signals enabled.
+ ACE_Sig_Set ss (1);
+
+ // Don't block out SIGQUIT.
+ ss.sig_del (SIGQUIT);
+
+ ACE_NEW_RETURN (Async_Timer_Queue::instance_,
+ ACE_Async_Timer_Queue_Adapter<ACE_Timer_List> (&ss),
+ 0);
+ }
+ return Async_Timer_Queue::instance_;
+}
+
+// Dump the contents of the queue.
+void
+Async_Timer_Queue::dump (void)
+{
+ ACE_DEBUG ((LM_DEBUG, "begin dumping timer queue\n"));
+
+ for (ACE_Timer_List_Iterator iter (Async_Timer_Queue::instance ()->timer_queue ());
+ iter.item () != 0;
+ iter.next ())
+ iter.item ()->dump ();
+
+ ACE_DEBUG ((LM_DEBUG, "end dumping timer queue\n"));
+}
// Command-line API.
@@ -71,8 +119,8 @@ parse_commands (char *buf)
ACE_Event_Handler *eh;
ACE_NEW_RETURN (eh, Timer_Handler, -1);
- long tid = timer_queue.schedule (eh, 0,
- ACE_OS::gettimeofday () + tv);
+ long tid = Async_Timer_Queue::instance ()->schedule
+ (eh, 0, ACE_OS::gettimeofday () + tv);
if (tid == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "schedule_timer"), -1);
@@ -84,9 +132,11 @@ parse_commands (char *buf)
{
const void *act;
- if (timer_queue.cancel (value, &act) == -1)
+ if (Async_Timer_Queue::instance ()->cancel (value, &act) == -1)
ACE_ERROR_RETURN ((LM_ERROR, "%p\n", "cancel_timer"), -1);
+ // In this case, the act will be 0, but it might be a real
+ // pointer.
delete (ACE_Event_Handler *) act;
ACE_DEBUG ((LM_DEBUG, "canceling %d\n", value));
@@ -99,7 +149,7 @@ parse_commands (char *buf)
}
static void
-handler (int signum)
+signal_handler (int signum)
{
ACE_DEBUG ((LM_DEBUG, "handling signal %S\n", signum));
@@ -108,15 +158,7 @@ handler (int signum)
/* NOTREACHED */
case SIGINT:
{
- ACE_DEBUG ((LM_DEBUG, "begin dumping timer queue\n"));
-
- for (TIMER_LIST_ITERATOR iter (timer_queue.timer_queue ());
- iter.item () != 0;
- iter.next ())
- iter.item ()->dump ();
-
- ACE_DEBUG ((LM_DEBUG, "end dumping timer queue\n"));
-
+ Async_Timer_Queue:;instance ()->dump ();
break;
/* NOTREACHED */
}
@@ -131,7 +173,8 @@ static void
register_signal_handlers (void)
{
// Register SIGQUIT (never blocked).
- ACE_Sig_Action sigquit ((ACE_SignalHandler) handler, SIGQUIT);
+ ACE_Sig_Action sigquit ((ACE_SignalHandler) signal_handler,
+ SIGQUIT);
ACE_UNUSED_ARG (sigquit);
// Don't let the SIGALRM interrupt the SIGINT handler!