summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-12-08 05:18:39 +0000
committerirfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1998-12-08 05:18:39 +0000
commitcd289f365b81f0ee568516d1208aec6e119ee146 (patch)
treee04a492d5355ecc4d6a0b28540097c3bc0afc3a6
parenta5b45c68550f87afa62f1ef0a6caef2f8e67469b (diff)
downloadATCD-cd289f365b81f0ee568516d1208aec6e119ee146.tar.gz
*** empty log message ***
-rw-r--r--ChangeLog-98b24
-rw-r--r--ace/ACE.cpp8
-rw-r--r--ace/DLL.cpp40
-rw-r--r--ace/Parse_Node.cpp43
-rw-r--r--ace/Svc_Conf_y.cpp11
-rw-r--r--examples/Reactor/Misc/Makefile1
-rw-r--r--examples/Reactor/Misc/Misc.dsp8
-rw-r--r--examples/Reactor/Misc/Misc.dsw14
-rw-r--r--examples/Reactor/Misc/early_timeouts.dsp57
-rw-r--r--examples/Reactor/Misc/notification.dsp8
-rw-r--r--examples/Reactor/Misc/reactors.dsp5
-rw-r--r--examples/Reactor/Misc/signals_1.dsp5
-rw-r--r--examples/Reactor/Misc/signals_2.dsp5
-rw-r--r--examples/Reactor/Misc/test_early_timeouts.cpp109
14 files changed, 276 insertions, 62 deletions
diff --git a/ChangeLog-98b b/ChangeLog-98b
index 41e12d13184..4846520cac7 100644
--- a/ChangeLog-98b
+++ b/ChangeLog-98b
@@ -1,3 +1,27 @@
+Mon Dec 07 22:58:53 1998 Irfan Pyarali <irfan@cs.wustl.edu>
+
+ * examples/Reactor/Misc/test_early_timeouts.cpp: On some
+ platforms, select() returns before the time value specified.
+ This tests counts the number of times this happens and the max
+ early timeout.
+
+ * ace/DLL.cpp (open): Added a call to ACE::ldopen() before calling
+ ACE_OS::dlopen(). The allows us to find the library is
+ predefined places and also expand the file name to the correct
+ syntax (prefix and suffix) according to the platform.
+
+ Also, fixed a bug where the <close_on_destruction_> flag has not
+ being consulted on a reopen.
+
+ * ace/ACE.cpp (ldfind): Moved the code that calls
+ ExpandEnvironmentStringsA() from
+ ACE_Location_Node::open_handle() to ACE::ldfind(). This code is
+ more general and therefore belongs in ACE::ldfind().
+
+ * ace/Parse_Node.cpp and ace/Svc_Conf_y.cpp: Fixed the incorrect
+ use of ASYS_WIDE_STRING. Remember that the string returned from
+ ASYS_WIDE_STRING is only valid for that line of code ;)
+
Mon Dec 7 19:10:24 EST 1998 James CE Johnson <jcej@lads.com>
* docs/tutorials/
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index 6b8819d0179..7c3afafd6b1 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -567,6 +567,14 @@ ACE::ldfind (const ASYS_TCHAR filename[],
{
ACE_TRACE ("ACE::ldfind");
+#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
+ ASYS_TCHAR expanded_filename[MAXPATHLEN];
+ if (::ExpandEnvironmentStringsA (filename,
+ expanded_filename,
+ sizeof expanded_filename))
+ filename = expanded_filename;
+#endif /* ACE_WIN32 */
+
ASYS_TCHAR tempcopy[MAXPATHLEN + 1];
ASYS_TCHAR searchpathname[MAXPATHLEN + 1];
ASYS_TCHAR searchfilename[MAXPATHLEN + 2];
diff --git a/ace/DLL.cpp b/ace/DLL.cpp
index 5ba8b1553dc..961b3e1cafd 100644
--- a/ace/DLL.cpp
+++ b/ace/DLL.cpp
@@ -37,9 +37,7 @@ ACE_DLL::ACE_DLL (ACE_DL_TYPE dll_name,
ACE_DLL::~ACE_DLL (void)
{
// CLose the library only if it hasn't been already.
- if (this->close_on_destruction_ != 0
- && this->handle_ != ACE_SHLIB_INVALID_HANDLE)
- this->close ();
+ this->close ();
}
// This method opens the library based on the mode specified using the
@@ -54,7 +52,7 @@ ACE_DLL::~ACE_DLL (void)
// relocation processing of any other object.
int
-ACE_DLL::open (ACE_DL_TYPE dll_name,
+ACE_DLL::open (ACE_DL_TYPE dll_filename,
int open_mode,
int close_on_destruction)
{
@@ -62,10 +60,23 @@ ACE_DLL::open (ACE_DL_TYPE dll_name,
// once without closing it which would cause handle memory leaks.
this->close ();
+ // Reset the flag
this->close_on_destruction_ = close_on_destruction;
+ // Find out where the library is
+ ASYS_TCHAR dll_pathname[MAXPATHLEN + 1];
+
+ // Transform the pathname into the appropriate dynamic link library
+ // by searching the ACE_LD_SEARCH_PATH.
+ int result = ACE::ldfind (ASYS_WIDE_STRING (dll_filename),
+ dll_pathname,
+ (sizeof dll_pathname / sizeof (ASYS_TCHAR)));
+ // Check for errors
+ if (result != 0)
+ return result;
+
// The ACE_SHLIB_HANDLE object is obtained.
- this->handle_ = ACE_OS::dlopen (dll_name, open_mode);
+ this->handle_ = ACE_OS::dlopen (dll_pathname, open_mode);
if (this->handle_ == ACE_SHLIB_INVALID_HANDLE)
ACE_ERROR_RETURN ((LM_ERROR,
@@ -88,17 +99,20 @@ ACE_DLL::symbol (ACE_DL_TYPE sym_name)
int
ACE_DLL::close (void)
{
+ int retval = 0;
+
// The handle is checked to see whether the library is closed
- // already. If not, it is closed and the handle is made invalid to
- // indicate that it's now closed.
- if (this->handle_ != ACE_SHLIB_INVALID_HANDLE)
+ // already and the <close_on_destruction_> flag is specified. If
+ // not, it is closed and the handle is made invalid to indicate that
+ // it's now closed.
+ if (this->close_on_destruction_ != 0 &&
+ this->handle_ != ACE_SHLIB_INVALID_HANDLE)
{
- int retval = ACE_OS::dlclose (this->handle_);
- this->handle_ = ACE_SHLIB_INVALID_HANDLE;
- return retval;
+ retval = ACE_OS::dlclose (this->handle_);
}
- else
- return 0;
+
+ this->handle_ = ACE_SHLIB_INVALID_HANDLE;
+ return retval;
}
// This method is used on error in an library operation.
diff --git a/ace/Parse_Node.cpp b/ace/Parse_Node.cpp
index fc314b0ab42..eb7e072e626 100644
--- a/ace/Parse_Node.cpp
+++ b/ace/Parse_Node.cpp
@@ -392,23 +392,18 @@ ACE_Location_Node::open_handle (void)
ACE_TRACE ("ACE_Location_Node::open_handle");
ASYS_TCHAR dl_pathname[MAXPATHLEN + 1];
- const ASYS_TCHAR *name =
- ASYS_WIDE_STRING (this->pathname ());
-
-#if defined (ACE_WIN32) && !defined (ACE_HAS_WINCE)
- ASYS_TCHAR dl_exppathname[MAXPATHLEN];
- if (::ExpandEnvironmentStringsA (name,
- dl_exppathname,
- MAXPATHLEN))
- name = dl_exppathname;
-#endif /* ACE_WIN32 */
// Transform the pathname into the appropriate dynamic link library
// by searching the ACE_LD_SEARCH_PATH.
- ACE::ldfind (name,
- dl_pathname,
- (sizeof dl_pathname / sizeof (ASYS_TCHAR)));
+ int result = ACE::ldfind (ASYS_WIDE_STRING (this->pathname ()),
+ dl_pathname,
+ (sizeof dl_pathname / sizeof (ASYS_TCHAR)));
+
+ // Check for errors
+ if (result != 0)
+ return 0;
+ // Set the handle
this->handle (ACE_OS::dlopen (dl_pathname));
if (this->handle () == 0)
@@ -458,11 +453,11 @@ ACE_Object_Node::symbol (ACE_Service_Object_Exterminator *)
ACE_TRACE ("ACE_Object_Node::symbol");
if (this->open_handle () != 0)
{
- ASYS_TCHAR *wname = ACE_const_cast (ASYS_TCHAR*,
- ASYS_WIDE_STRING (this->object_name_));
+ ASYS_TCHAR *object_name = ACE_const_cast (ASYS_TCHAR *, this->object_name_);
+
this->symbol_ = (void *)
ACE_OS::dlsym ((ACE_SHLIB_HANDLE) this->handle (),
- wname);
+ ASYS_WIDE_STRING (object_name));
if (this->symbol_ == 0)
{
@@ -470,7 +465,7 @@ ACE_Object_Node::symbol (ACE_Service_Object_Exterminator *)
ACE_ERROR ((LM_ERROR,
ASYS_TEXT ("dlsym failed for object %s\n"),
- wname));
+ ASYS_WIDE_STRING (object_name)));
ASYS_TCHAR *errmsg = ACE_OS::dlerror ();
@@ -524,12 +519,11 @@ ACE_Function_Node::symbol (ACE_Service_Object_Exterminator *gobbler)
// Locate the factory function <function_name> in the shared
// object.
- ASYS_TCHAR *wname = ACE_const_cast (ASYS_TCHAR *,
- ASYS_WIDE_STRING (this->function_name_));
+ ASYS_TCHAR *function_name = ACE_const_cast (ASYS_TCHAR *, this->function_name_);
func = (void *(*)(ACE_Service_Object_Exterminator *))
ACE_OS::dlsym ((ACE_SHLIB_HANDLE) this->handle (),
- wname);
+ ASYS_WIDE_STRING (function_name));
if (func == 0)
{
@@ -541,7 +535,7 @@ ACE_Function_Node::symbol (ACE_Service_Object_Exterminator *gobbler)
ACE_ERROR ((LM_ERROR,
ASYS_TEXT ("dlsym failed for function %s\n"),
- wname));
+ ASYS_WIDE_STRING (function_name)));
ASYS_TCHAR *errmsg = ACE_OS::dlerror ();
@@ -644,8 +638,7 @@ ACE_Static_Function_Node::symbol (ACE_Service_Object_Exterminator *)
ACE_Static_Svc_Descriptor **ssdp = 0;
ACE_STATIC_SVCS &svcs = *ACE_Service_Config::static_svcs ();
- ASYS_TCHAR *wname = ACE_const_cast (ASYS_TCHAR *,
- ASYS_WIDE_STRING (this->function_name_));
+ ASYS_TCHAR *function_name = ACE_const_cast (ASYS_TCHAR *, this->function_name_);
for (ACE_STATIC_SVCS_ITERATOR iter (svcs);
iter.next (ssdp) != 0;
@@ -653,7 +646,7 @@ ACE_Static_Function_Node::symbol (ACE_Service_Object_Exterminator *)
{
ACE_Static_Svc_Descriptor *ssd = *ssdp;
if (ACE_OS::strcmp (ssd->name_,
- wname) == 0)
+ ASYS_WIDE_STRING (function_name)) == 0)
func = (void *(*)(void)) ssd->alloc_;
}
@@ -667,7 +660,7 @@ ACE_Static_Function_Node::symbol (ACE_Service_Object_Exterminator *)
ACE_ERROR_RETURN ((LM_ERROR,
ASYS_TEXT ("no static service registered for function %s\n"),
- wname),
+ ASYS_WIDE_STRING (function_name)),
0);
}
}
diff --git a/ace/Svc_Conf_y.cpp b/ace/Svc_Conf_y.cpp
index 6b26098a479..65579df2a2b 100644
--- a/ace/Svc_Conf_y.cpp
+++ b/ace/Svc_Conf_y.cpp
@@ -305,14 +305,13 @@ ace_get_module (ACE_Static_Node *str_rec,
const ACE_Service_Type *sv = svc_type->record ();
type = sv->type ();
ACE_Module_Type *mt = (ACE_Module_Type *) type;
- const char *module_type_name = svc_type->name ();
- const ASYS_TCHAR *wname = ASYS_WIDE_STRING (module_type_name);
+ ASYS_TCHAR *module_type_name = ACE_const_cast (ASYS_TCHAR *, svc_type->name ());
if (sr == 0 || st == 0 || mt == 0)
{
ACE_ERROR ((LM_ERROR,
ASYS_TEXT ("cannot locate Module_Type %s or STREAM_Type %s\n"),
- wname,
+ ASYS_WIDE_STRING (module_type_name),
ASYS_WIDE_STRING (str_rec->name ())));
ace_yyerrno++;
}
@@ -321,13 +320,13 @@ ace_get_module (ACE_Static_Node *str_rec,
// Module_Type object from the svc.conf file.
ACE_Module<ACE_SYNCH> *mp = (ACE_Module<ACE_SYNCH> *) mt->object ();
- if (ACE_OS::strcmp (mp->name (), wname) != 0)
+ if (ACE_OS::strcmp (mp->name (), ASYS_WIDE_STRING (module_type_name)) != 0)
{
ACE_DEBUG ((LM_DEBUG,
ASYS_TEXT ("warning: assigning Module_Type name %s to Module %s since names differ\n"),
- wname,
+ ASYS_WIDE_STRING (module_type_name),
mp->name ()));
- mp->name (wname);
+ mp->name (ASYS_WIDE_STRING (module_type_name));
}
return mt;
diff --git a/examples/Reactor/Misc/Makefile b/examples/Reactor/Misc/Makefile
index 789afe8c328..d31513c9f38 100644
--- a/examples/Reactor/Misc/Makefile
+++ b/examples/Reactor/Misc/Makefile
@@ -16,6 +16,7 @@ BIN = pingpong \
test_signals_1 \
test_signals_2 \
test_time_value \
+ test_early_timeouts \
test_timer_queue
LSRC = $(addsuffix .cpp,$(BIN))
diff --git a/examples/Reactor/Misc/Misc.dsp b/examples/Reactor/Misc/Misc.dsp
index 9a631221df7..e7ae8041428 100644
--- a/examples/Reactor/Misc/Misc.dsp
+++ b/examples/Reactor/Misc/Misc.dsp
@@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="timer_queue" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
@@ -33,12 +33,12 @@ RSC=rc.exe
# PROP BASE Target_Dir ".\timer_queue"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "."
-# PROP Intermediate_Dir ".\Debug"
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ".\timer_queue"
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/examples/Reactor/Misc/Misc.dsw b/examples/Reactor/Misc/Misc.dsw
index 064b0b572e7..ba9d68a1230 100644
--- a/examples/Reactor/Misc/Misc.dsw
+++ b/examples/Reactor/Misc/Misc.dsw
@@ -1,8 +1,20 @@
-Microsoft Developer Studio Workspace File, Format Version 6.00
+Microsoft Developer Studio Workspace File, Format Version 5.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
+Project: "early_timeouts"=.\early_timeouts.dsp - Package Owner=<4>
+
+Package=<5>
+{{{
+}}}
+
+Package=<4>
+{{{
+}}}
+
+###############################################################################
+
Project: "notification"=.\notification.dsp - Package Owner=<4>
Package=<5>
diff --git a/examples/Reactor/Misc/early_timeouts.dsp b/examples/Reactor/Misc/early_timeouts.dsp
new file mode 100644
index 00000000000..df3b94709f4
--- /dev/null
+++ b/examples/Reactor/Misc/early_timeouts.dsp
@@ -0,0 +1,57 @@
+# Microsoft Developer Studio Project File - Name="early_timeouts" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Console Application" 0x0103
+
+CFG=early_timeouts - Win32 Debug
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "early_timeouts.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "early_timeouts.mak" CFG="early_timeouts - Win32 Debug"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "early_timeouts - Win32 Debug" (based on\
+ "Win32 (x86) Console Application")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+RSC=rc.exe
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir "early_ti"
+# PROP BASE Intermediate_Dir "early_ti"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
+# ADD LINK32 aced.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept /libpath:"..\..\..\ace"
+# Begin Target
+
+# Name "early_timeouts - Win32 Debug"
+# Begin Source File
+
+SOURCE=.\test_early_timeouts.cpp
+# End Source File
+# End Target
+# End Project
diff --git a/examples/Reactor/Misc/notification.dsp b/examples/Reactor/Misc/notification.dsp
index a2e6753eb57..33b38e946ff 100644
--- a/examples/Reactor/Misc/notification.dsp
+++ b/examples/Reactor/Misc/notification.dsp
@@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="notification" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
@@ -33,12 +33,12 @@ RSC=rc.exe
# PROP BASE Target_Dir ".\notification"
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "."
-# PROP Intermediate_Dir ".\Debug"
+# PROP Output_Dir ""
+# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ".\notification"
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/examples/Reactor/Misc/reactors.dsp b/examples/Reactor/Misc/reactors.dsp
index 3b08018b721..88ed8cd53ab 100644
--- a/examples/Reactor/Misc/reactors.dsp
+++ b/examples/Reactor/Misc/reactors.dsp
@@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="reactors" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
@@ -21,7 +21,6 @@ CFG=reactors - Win32 Debug
!MESSAGE
# Begin Project
-# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
@@ -38,7 +37,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/examples/Reactor/Misc/signals_1.dsp b/examples/Reactor/Misc/signals_1.dsp
index d28a662830a..1f49c6c6f8e 100644
--- a/examples/Reactor/Misc/signals_1.dsp
+++ b/examples/Reactor/Misc/signals_1.dsp
@@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="signals_1" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
@@ -21,7 +21,6 @@ CFG=signals_1 - Win32 Debug
!MESSAGE
# Begin Project
-# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
@@ -38,7 +37,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/examples/Reactor/Misc/signals_2.dsp b/examples/Reactor/Misc/signals_2.dsp
index 75a18bbbd68..36b0386d4ad 100644
--- a/examples/Reactor/Misc/signals_2.dsp
+++ b/examples/Reactor/Misc/signals_2.dsp
@@ -1,5 +1,5 @@
# Microsoft Developer Studio Project File - Name="signals_2" - Package Owner=<4>
-# Microsoft Developer Studio Generated Build File, Format Version 6.00
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Console Application" 0x0103
@@ -21,7 +21,6 @@ CFG=signals_2 - Win32 Debug
!MESSAGE
# Begin Project
-# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
@@ -38,7 +37,7 @@ RSC=rc.exe
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
-# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\..\\" /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "..\..\.." /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
# ADD BASE RSC /l 0x409 /d "_DEBUG"
# ADD RSC /l 0x409 /d "_DEBUG"
BSC32=bscmake.exe
diff --git a/examples/Reactor/Misc/test_early_timeouts.cpp b/examples/Reactor/Misc/test_early_timeouts.cpp
new file mode 100644
index 00000000000..09f26750218
--- /dev/null
+++ b/examples/Reactor/Misc/test_early_timeouts.cpp
@@ -0,0 +1,109 @@
+// $Id$
+
+// ================================================================
+//
+// = LIBRARY
+// examples/Reactor/Misc/
+//
+// = FILENAME
+// test_early_timeouts.cpp
+//
+// = DESCRIPTION
+// On some platforms, select() returns before the time value
+// specified. This tests counts the number of times this happens
+// and the max early timeout.
+//
+// = AUTHOR
+// Irfan Pyarali
+//
+// ================================================================
+
+#include "ace/Handle_Set.h"
+#include "ace/Pipe.h"
+
+ACE_RCSID(Misc, test_early_timeouts, "$Id$")
+
+int
+main (int argc, char **argv)
+{
+ // Mumber of seconds this test should run
+ int runtime_in_seconds = 10;
+
+ // Iterations
+ int iterations = runtime_in_seconds * 10;
+
+ // 100 millisecond timeout
+ ACE_Time_Value timeout (0, 100000);
+
+ // Time before starting select
+ ACE_Time_Value starting_time_of_day;
+
+ // Time before starting select
+ ACE_Time_Value ending_time_of_day;
+
+ // Number of times the timer expired early
+ int no_of_early_timers = 0;
+
+ // Maximum early timeout
+ ACE_Time_Value maximum_early_timeout;
+
+ //
+ // Dummy handle and handle set
+ // Note that some OS do not like "empty selects"
+ //
+
+ // Dummy handle set
+ ACE_Handle_Set dummy_handle_set;
+
+ // Dummy pipe
+ ACE_Pipe dummy_pipe;
+ int result = dummy_pipe.open ();
+ ACE_ASSERT (result == 0);
+
+ for (int i = 1; i <= iterations; i++)
+ {
+ // Add dummy handle to dummy set
+ dummy_handle_set.set_bit (dummy_pipe.read_handle ());
+
+ // Note the time before select
+ starting_time_of_day = ACE_OS::gettimeofday ();
+
+ // Wait for timeout
+ result = ACE_OS::select ((int) dummy_pipe.read_handle (), dummy_handle_set, 0, 0, &timeout);
+ ACE_ASSERT (result == 0);
+
+ // Note the time after select
+ ending_time_of_day = ACE_OS::gettimeofday ();
+
+ // Expected ending time
+ ACE_Time_Value expected_ending_time_of_day =
+ starting_time_of_day + timeout;
+
+ // If the timer expired early
+ if (ending_time_of_day < expected_ending_time_of_day)
+ {
+ // How early
+ ACE_Time_Value early_timeout = expected_ending_time_of_day - ending_time_of_day;
+
+ // Increment number of early timers
+ no_of_early_timers++;
+
+ // Check max early timeout
+ if (early_timeout > maximum_early_timeout)
+ {
+ maximum_early_timeout = early_timeout;
+ }
+ }
+ }
+
+ ACE_DEBUG ((LM_DEBUG,
+ "There were %d early timers out of %d calls to select() (%f%%)\n"
+ "The max early timeout was: %dsec %dusec\n",
+ no_of_early_timers,
+ iterations,
+ float (no_of_early_timers) / iterations * 100,
+ maximum_early_timeout.sec (),
+ maximum_early_timeout.usec ()));
+
+ return 0;
+}