summaryrefslogtreecommitdiff
path: root/ace
diff options
context:
space:
mode:
authorschmidt <douglascraigschmidt@users.noreply.github.com>1997-10-07 03:58:33 +0000
committerschmidt <douglascraigschmidt@users.noreply.github.com>1997-10-07 03:58:33 +0000
commit2b4d9055b3e815535654a0409f531998a3f77078 (patch)
treeb34ffede153369290b047098c8b15318b2316e32 /ace
parentd66aa032b841075b05ebbbf129a249e35a398fdd (diff)
downloadATCD-2b4d9055b3e815535654a0409f531998a3f77078.tar.gz
*** empty log message ***
Diffstat (limited to 'ace')
-rw-r--r--ace/OS.cpp36
-rw-r--r--ace/Parse_Node.cpp71
-rw-r--r--ace/Parse_Node.h21
-rw-r--r--ace/Svc_Conf.y4
-rw-r--r--ace/Svc_Conf_y.cpp110
-rw-r--r--ace/Task.cpp1
-rw-r--r--ace/Thread_Manager.h27
-rw-r--r--ace/Thread_Manager.i19
8 files changed, 227 insertions, 62 deletions
diff --git a/ace/OS.cpp b/ace/OS.cpp
index a9b446f628a..6202166aac6 100644
--- a/ace/OS.cpp
+++ b/ace/OS.cpp
@@ -1410,6 +1410,22 @@ ACE_Thread_Adapter::invoke (void)
// exits.
}
+#if 0
+ if (func == ACE_Task_Base::svc_run)
+ {
+ ACE_Task_Base *task_ptr = (ACE_Task_Base *) arg;
+ ACE_Thread_Manager *thr_mgr_ptr = task_ptr->thr_mgr ();
+
+ // This calls the Task->close() hook.
+ task_ptr->cleanup (task_ptr, 0);
+
+ // This prevents a second invocation of the cleanup code (called
+ // later by ACE_Thread_Manager::exit()).
+
+ thr_mgr_ptr->at_exit (task_ptr, NULL, 0);
+ }
+#endif /* 0 */
+
// If dropped off end, call destructors for thread-specific storage.
ACE_TSS_Cleanup::instance ()->exit (status);
@@ -1425,7 +1441,25 @@ ACE_Thread_Adapter::invoke (void)
}
# endif /* ACE_WIN32 && ACE_HAS_MFC && ACE_HAS_MFS != 0*/
- return status;
+ void *result = (void *) (*func) (arg); // Call thread entry point.
+
+#if 0
+ if (func == ACE_Task_Base::svc_run)
+ {
+ ACE_Task_Base *task_ptr = (ACE_Task_Base *) arg;
+ ACE_Thread_Manager *thr_mgr_ptr = task_ptr->thr_mgr ();
+
+ // This calls the Task->close() hook.
+ task_ptr->cleanup (task_ptr, 0);
+
+ // This prevents a second invocation of the cleanup code (called
+ // later by ACE_Thread_Manager::exit()).
+
+ thr_mgr_ptr->at_exit (task_ptr, NULL, 0);
+ }
+#endif /* 0 */
+
+ return result;
#else
return (void *) (*func) (arg); // Call thread entry point.
#endif /* ACE_WIN32 || ACE_HAS_TSS_EMULATION */
diff --git a/ace/Parse_Node.cpp b/ace/Parse_Node.cpp
index 6b4ff230331..d9cd0d1aa1a 100644
--- a/ace/Parse_Node.cpp
+++ b/ace/Parse_Node.cpp
@@ -539,6 +539,77 @@ ACE_Dummy_Node::~ACE_Dummy_Node (void)
delete (ACE_Parse_Node *) this->mods_;
}
+ACE_ALLOC_HOOK_DEFINE(ACE_Static_Function_Node)
+
+void
+ACE_Static_Function_Node::dump (void) const
+{
+ ACE_TRACE ("ACE_Static_Function_Node::dump");
+}
+
+ACE_Static_Function_Node::ACE_Static_Function_Node (const char *func_name)
+ : function_name_ (func_name)
+{
+ ACE_TRACE ("ACE_Static_Function_Node::ACE_Static_Function_Node");
+ this->must_delete_ = 1;
+}
+
+const void *
+ACE_Static_Function_Node::symbol (void)
+{
+ ACE_TRACE ("ACE_Static_Function_Node::symbol");
+
+ const void *(*func) (void) = 0;
+ this->symbol_ = 0;
+
+ // Locate the factory function <function_name> in the statically
+ // linked svcs.
+
+ ACE_Static_Svc_Descriptor **ssdp = 0;
+ ACE_STATIC_SVCS &svcs = *ACE_Service_Config::static_svcs ();
+
+ for (ACE_STATIC_SVCS_ITERATOR iter (svcs);
+ iter.next (ssdp) != 0;
+ iter.advance ())
+ {
+ ACE_Static_Svc_Descriptor *ssd = *ssdp;
+ if (ACE_OS::strcmp (ssd->name_, this->function_name_) == 0)
+ func = (const void *(*)(void)) ssd->alloc_;
+ }
+
+ if (func == 0)
+ {
+ ace_yyerrno++;
+
+ if (this->symbol_ == 0)
+ {
+ ace_yyerrno++;
+
+ ACE_ERROR ((LM_ERROR,
+ "no static service registered for function %s\n
+",
+ this->function_name_));
+ }
+ }
+
+ // Invoke the factory function and record it's return value.
+ this->symbol_ = (*func) ();
+
+ if (this->symbol_ == 0)
+ {
+ ace_yyerrno++;
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "%p\n", this->function_name_), 0);
+ }
+
+ return this->symbol_;
+}
+
+ACE_Static_Function_Node::~ACE_Static_Function_Node (void)
+{
+ ACE_TRACE ("ACE_Static_Function_Node::~ACE_Static_Function_Node");
+}
+
#if defined (ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION)
#elif defined (ACE_HAS_TEMPLATE_INSTANTIATION_PRAGMA)
#endif /* ACE_HAS_EXPLICIT_TEMPLATE_INSTANTIATION */
diff --git a/ace/Parse_Node.h b/ace/Parse_Node.h
index 16bc566fd69..b982d487f7f 100644
--- a/ace/Parse_Node.h
+++ b/ace/Parse_Node.h
@@ -248,6 +248,27 @@ private:
const ACE_Parse_Node *mods_;
};
+class ACE_Export ACE_Static_Function_Node : public ACE_Location_Node
+ // = TITLE
+ // Keeps track of the symbol name for a function that is not
+ // linked in from a DLL, but is statically linked with the
+ // application.
+{
+public:
+ ACE_Static_Function_Node (const char *func_name);
+ virtual const void *symbol (void);
+ virtual ~ACE_Static_Function_Node (void);
+
+ void dump (void) const;
+ // Dump the state of an object.
+
+ ACE_ALLOC_HOOK_DECLARE;
+ // Declare the dynamic allocation hooks.
+
+private:
+ const char *function_name_;
+};
+
#if defined (__ACE_INLINE__)
#include "ace/Parse_Node.i"
#endif /* __ACE_INLINE__ */
diff --git a/ace/Svc_Conf.y b/ace/Svc_Conf.y
index ad457e8bc50..d173bc1e772 100644
--- a/ace/Svc_Conf.y
+++ b/ace/Svc_Conf.y
@@ -226,6 +226,10 @@ svc_initializer
{
$$ = new ACE_Function_Node ($1, $3);
}
+ | ACE_COLON ACE_IDENT ACE_LPAREN ACE_RPAREN
+ {
+ $$ = new ACE_Static_Function_Node ($2);
+ }
;
type
diff --git a/ace/Svc_Conf_y.cpp b/ace/Svc_Conf_y.cpp
index 33b1f64c478..3190dcd43da 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";
@@ -47,56 +45,59 @@ short ace_yylhs[] = { -1,
0, 0, 0, 14, 14, 14, 14, 14, 14, 5,
6, 7, 8, 9, 11, 18, 11, 15, 15, 19,
12, 12, 10, 10, 13, 13, 13, 13, 13, 16,
- 4, 4, 4, 17, 17, 3, 3, 3, 2, 2,
- 1, 1,
+ 4, 4, 4, 17, 17, 17, 3, 3, 3, 2,
+ 2, 1, 1,
};
short ace_yylen[] = { 2,
2, 2, 0, 1, 1, 1, 1, 1, 1, 3,
3, 2, 2, 2, 3, 0, 4, 1, 1, 0,
4, 0, 2, 0, 1, 1, 1, 1, 1, 4,
- 1, 1, 0, 3, 5, 2, 2, 2, 1, 0,
- 1, 1,
+ 1, 1, 0, 3, 5, 4, 2, 2, 2, 1,
+ 0, 1, 1,
};
short ace_yydefred[] = { 3,
0, 2, 0, 0, 0, 0, 0, 0, 4, 5,
6, 7, 8, 9, 1, 0, 0, 0, 12, 13,
- 14, 16, 18, 19, 0, 0, 0, 0, 0, 39,
- 10, 11, 0, 20, 15, 36, 38, 37, 41, 42,
- 0, 0, 17, 24, 0, 31, 32, 30, 0, 0,
- 21, 25, 26, 27, 28, 29, 23, 0, 35,
+ 14, 16, 18, 19, 0, 0, 0, 0, 0, 40,
+ 10, 11, 0, 20, 15, 37, 39, 38, 42, 43,
+ 0, 0, 0, 17, 24, 0, 0, 31, 32, 30,
+ 0, 0, 0, 21, 25, 26, 27, 28, 29, 23,
+ 36, 0, 35,
};
short ace_yydgoto[] = { 1,
- 41, 31, 29, 48, 9, 10, 11, 12, 13, 49,
- 14, 35, 57, 15, 25, 17, 42, 33, 44,
+ 42, 31, 29, 50, 9, 10, 11, 12, 13, 51,
+ 14, 35, 60, 15, 25, 17, 43, 33, 45,
};
short ace_yysindex[] = { 0,
- -244, 0, -266, -260, -250, -243, -241, -247, 0, 0,
- 0, 0, 0, 0, 0, -240, -237, -237, 0, 0,
- 0, 0, 0, 0, -238, -236, -233, -231, -239, 0,
- 0, 0, -238, 0, 0, 0, 0, 0, 0, 0,
- -242, -235, 0, 0, -232, 0, 0, 0, -253, -226,
- 0, 0, 0, 0, 0, 0, 0, -234, 0,
+ -228, 0, -266, -260, -254, -246, -244, -247, 0, 0,
+ 0, 0, 0, 0, 0, -251, -235, -235, 0, 0,
+ 0, 0, 0, 0, -237, -249, -238, -236, -252, 0,
+ 0, 0, -237, 0, 0, 0, 0, 0, 0, 0,
+ -231, -234, -248, 0, 0, -230, -229, 0, 0, 0,
+ -253, -225, -227, 0, 0, 0, 0, 0, 0, 0,
+ 0, -224, 0,
};
short ace_yyrindex[] = { 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 27, 27, 0, 0,
0, 0, 0, 0, 46, 0, 0, 0, 0, 0,
0, 0, 46, 0, 0, 0, 0, 0, 0, 0,
- 0, 20, 0, 0, 0, 0, 0, 0, 0, 1,
- 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 20, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0,
};
short ace_yygindex[] = { 0,
- 0, 18, 0, 0, -8, -6, -9, -2, -1, 0,
- 0, 16, 0, 0, 0, 0, 0, 0, 0,
+ 0, 31, 0, 0, -8, -6, -1, 2, 3, 0,
+ 0, 18, 0, 0, 0, 0, 0, 0, 0,
};
#define YYTABLESIZE 308
short ace_yytable[] = { 23,
34, 24, 16, 3, 4, 5, 6, 7, 18, 3,
- 4, 2, 3, 4, 5, 6, 7, 8, 19, 33,
- 51, 22, 26, 27, 28, 20, 40, 21, 39, 40,
- 46, 47, 30, 45, 34, 32, 50, 59, 36, 54,
- 52, 37, 53, 38, 58, 22, 55, 56, 43, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 4, 26, 27, 28, 19, 39, 40, 48, 49, 33,
+ 54, 22, 20, 41, 21, 36, 41, 2, 3, 4,
+ 5, 6, 7, 8, 30, 34, 37, 46, 38, 53,
+ 52, 47, 55, 62, 56, 22, 61, 63, 32, 57,
+ 44, 0, 58, 59, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
@@ -119,17 +120,17 @@ short ace_yytable[] = { 23,
0, 0, 0, 0, 0, 0, 34, 34, 34, 34,
34, 34, 34, 0, 0, 0, 34, 34, 0, 0,
34, 0, 0, 34, 34, 33, 33, 33, 33, 33,
- 33, 33, 40, 40, 40, 40, 40, 40, 40, 33,
- 0, 0, 33, 33, 0, 0, 0, 0, 0, 40,
- 40, 22, 22, 22, 22, 22, 22, 22,
+ 33, 33, 41, 41, 41, 41, 41, 41, 41, 33,
+ 0, 0, 33, 33, 0, 0, 0, 0, 0, 41,
+ 41, 22, 22, 22, 22, 22, 22, 22,
};
short ace_yycheck[] = { 8,
0, 8, 269, 257, 258, 259, 260, 261, 269, 257,
- 258, 256, 257, 258, 259, 260, 261, 262, 269, 0,
- 274, 269, 263, 264, 265, 269, 0, 269, 268, 269,
- 266, 267, 270, 276, 273, 18, 269, 272, 275, 49,
- 49, 275, 49, 275, 271, 0, 49, 49, 33, -1,
- -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+ 258, 263, 264, 265, 269, 268, 269, 266, 267, 0,
+ 274, 269, 269, 276, 269, 275, 0, 256, 257, 258,
+ 259, 260, 261, 262, 270, 273, 275, 269, 275, 269,
+ 271, 276, 51, 271, 51, 0, 272, 272, 18, 51,
+ 33, -1, 51, 51, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
@@ -212,6 +213,7 @@ char *ace_yyrule[] = {
"status :",
"svc_initializer : pathname ACE_COLON ACE_IDENT",
"svc_initializer : pathname ACE_COLON ACE_IDENT ACE_LPAREN ACE_RPAREN",
+"svc_initializer : ACE_COLON ACE_IDENT ACE_LPAREN ACE_RPAREN",
"type : ACE_MODULE_T ACE_STAR",
"type : ACE_SVC_OBJ_T ACE_STAR",
"type : ACE_STREAM_T ACE_STAR",
@@ -241,7 +243,7 @@ YYSTYPE ace_yylval;
#define ace_yystacksize YYSTACKSIZE
short ace_yyss[YYSTACKSIZE];
YYSTYPE ace_yyvs[YYSTACKSIZE];
-#line 257 "Svc_Conf.y"
+#line 261 "Svc_Conf.y"
// Prints the error string to standard output. Cleans up the error
// messages.
@@ -350,7 +352,7 @@ main (int argc, char *argv[])
return ace_yyparse ();
}
#endif /* DEBUGGING */
-#line 352 "Svc_Conf_y.cpp"
+#line 356 "Svc_Conf_y.cpp"
#define YYABORT goto ace_yyabort
#define YYACCEPT goto ace_yyaccept
#define YYERROR goto ace_yyerrlab
@@ -378,7 +380,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;
@@ -408,7 +410,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;
@@ -423,7 +425,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;
@@ -440,7 +442,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;
@@ -468,7 +470,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;
@@ -483,7 +485,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;
@@ -509,7 +511,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')
@@ -526,7 +528,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;
@@ -861,28 +863,34 @@ case 35:
}
break;
case 36:
-#line 233 "Svc_Conf.y"
+#line 230 "Svc_Conf.y"
{
- ace_yyval.type_ = ACE_MODULE_T;
+ ace_yyval.location_node_ = new ACE_Static_Function_Node (ace_yyvsp[-2].ident_);
}
break;
case 37:
#line 237 "Svc_Conf.y"
{
- ace_yyval.type_ = ACE_SVC_OBJ_T;
+ ace_yyval.type_ = ACE_MODULE_T;
}
break;
case 38:
#line 241 "Svc_Conf.y"
{
+ ace_yyval.type_ = ACE_SVC_OBJ_T;
+ }
+break;
+case 39:
+#line 245 "Svc_Conf.y"
+{
ace_yyval.type_ = ACE_STREAM_T;
}
break;
-case 40:
-#line 248 "Svc_Conf.y"
+case 41:
+#line 252 "Svc_Conf.y"
{ ace_yyval.ident_ = 0; }
break;
-#line 883 "Svc_Conf_y.cpp"
+#line 893 "Svc_Conf_y.cpp"
}
ace_yyssp -= ace_yym;
ace_yystate = *ace_yyssp;
diff --git a/ace/Task.cpp b/ace/Task.cpp
index 6049eb75b95..028dab05688 100644
--- a/ace/Task.cpp
+++ b/ace/Task.cpp
@@ -10,7 +10,6 @@
#include "ace/Task.i"
#endif /* __ACE_INLINE__ */
-
ACE_Task_Base::ACE_Task_Base (ACE_Thread_Manager *thr_man)
: thr_count_ (0),
thr_mgr_ (thr_man),
diff --git a/ace/Thread_Manager.h b/ace/Thread_Manager.h
index a65f985becc..45d928529b9 100644
--- a/ace/Thread_Manager.h
+++ b/ace/Thread_Manager.h
@@ -47,8 +47,9 @@ public:
ACE_Thread_State state (void);
// Current state of the thread.
- ACE_Task_Base *task_;
- // Pointer to an ACE_Task;
+ ACE_Task_Base *task (void);
+ // Return the pointer to an <ACE_Task_Base> or NULL if there's no
+ // <ACE_Task_Base> associated with this thread.;
void dump (void) const;
// Dump the state of an object.
@@ -89,6 +90,9 @@ private:
// If a thread is *not* created detached then if someone calls
// <ACE_Thread_Manager::wait>, we need to join with that thread (and
// close down the handle).
+
+ ACE_Task_Base *task_;
+ // Pointer to an <ACE_Task_Base> or NULL if there's no <ACE_Task_Base>;
};
// Forward declaration.
@@ -211,6 +215,11 @@ public:
// necessary (because a thread can always just call
// <ACE_Thread::thr_self>). However, we put it here to be complete.
+ ACE_Task_Base *task (void);
+ // Returns a pointer to the current <ACE_Task_Base> we're executing
+ // in if this thread is indeed running in an <ACE_Task_Base>, else
+ // return 0.
+
// = Suspend methods, which isn't supported on POSIX pthreads (will not block).
int suspend_all (void);
// Suspend all threads
@@ -254,9 +263,9 @@ public:
int get_grp (ACE_thread_t, int &grp_id);
// = The following methods are new methods which resemble current
- // methods in ACE_Thread Manager. For example, the new apply_task()
- // method resembles the old apply_thr() method, and suspend_task()
- // resembles suspend_thr().
+ // methods in <ACE_Thread Manager>. For example, the <apply_task>
+ // method resembles the <apply_thr> method, and <suspend_task>
+ // resembles <suspend_thr>.
// = Operations on ACE_Tasks.
int wait_task (ACE_Task_Base *task);
@@ -276,10 +285,10 @@ public:
// functionality.
int num_tasks_in_group (int grp_id);
- // Returns the number of <ACE_Task> in a group.
+ // Returns the number of <ACE_Task_Base> in a group.
int num_threads_in_task (ACE_Task_Base *task);
- // Returns the number of threads in an <ACE_Task>.
+ // Returns the number of threads in an <ACE_Task_Base>.
int task_list (int grp_id,
ACE_Task_Base *task_list[],
@@ -291,14 +300,14 @@ public:
ACE_thread_t thread_list[],
size_t n);
// Returns in <thread_list> a list of up to <h> thread ids in an
- // <ACE_Task>. The caller must allocate the memory for
+ // <ACE_Task_Base>. The caller must allocate the memory for
// <thread_list>.
int hthread_list (ACE_Task_Base *task,
ACE_hthread_t hthread_list[],
size_t n);
// Returns in <hthread_list> a list of up to <n> thread handles in
- // an <ACE_Task>. The caller must allocate memory for
+ // an <ACE_Task_Base>. The caller must allocate memory for
// <hthread_list>.
// = Set/get group ids for a particular task.
diff --git a/ace/Thread_Manager.i b/ace/Thread_Manager.i
index e502817256c..3344c108e73 100644
--- a/ace/Thread_Manager.i
+++ b/ace/Thread_Manager.i
@@ -10,6 +10,13 @@ ACE_Thread_Descriptor::self (void)
ACE_TRACE ("ACE_Thread_Descriptor::self");
return this->thr_id_;
}
+
+ACE_INLINE ACE_Task_Base *
+ACE_Thread_Descriptor::task (void)
+{
+ ACE_TRACE ("ACE_Thread_Descriptor::task");
+ return this->task_;
+}
// Unique kernel-level thread handle.
@@ -84,3 +91,15 @@ ACE_Thread_Manager::thr_self (void)
ACE_TRACE ("ACE_Thread_Manager::thr_self");
return ACE_Thread::self ();
}
+
+ACE_INLINE ACE_Task_Base *
+ACE_Thread_Manager::task (void)
+{
+ ACE_TRACE ("ACE_Thread_Manager::task");
+ ACE_Thread_Descriptor td;
+
+ if (this->thread_descriptor (ACE_Thread::self (), td) == -1)
+ return 0;
+ else
+ return td.task ();
+}