summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-10-15 15:31:00 +0000
committerwilson_d <wilson_d@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>2004-10-15 15:31:00 +0000
commiteb45a6c02549cfc94d96ec89602f9509105aab6e (patch)
treeaf841fdcc92ac1d8ccacfb6d62ca883c6c0d67c7
parentbe3fd004fee4c419ffc72b2b6ded470c306860c0 (diff)
downloadATCD-eb45a6c02549cfc94d96ec89602f9509105aab6e.tar.gz
ChangeLogTag: Fri Oct 15 10:09:34 2004 Dale Wilson <wilson_d@ociweb.com>
-rw-r--r--ChangeLog44
-rw-r--r--tests/TSS_Test.cpp29
-rw-r--r--tests/TSS_Test_Errno.h23
3 files changed, 83 insertions, 13 deletions
diff --git a/ChangeLog b/ChangeLog
index d0cc81b38c6..ebdb58e2be8 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,8 +1,40 @@
+Fri Oct 15 10:09:34 2004 Dale Wilson <wilson_d@ociweb.com>
+
+ * tests/TSS_Test.cpp:
+ * tests/TSS_Test_Errno.h:
+
+ Olli's report that TSS_Test was failing when TSS_Emulation prompted me
+ to take a closer look at TSS_Test. I found a number of problems, none
+ of which was related to the TSS Emulation issue. That will be addressed
+ separately.
+
+ The most serious problem was attempting to log a message from within
+ a TSS cleanup function. Since the log message buffer is itself a TSS
+ object this only works of the TSS objects happen to be deleted in the
+ "right" order. There was even a comment that said:
+ // Anyways, for whatever reason, the ACE_DEBUG causes a
+ // core dump on LynxOS 2.5.0.
+
+ I was amused by: void *ptr; operator delete (ptr);. It works, but it's a bad
+ example to set for people who might read this code as an example of how to
+ clean up "real" TSS objects. Sometimes calling the destructor is important.
+
+ If the comments can be trusted, the code was deleting TSS objects twice when
+ ACE_HAS_PTHREADS_DRAFT4 was defined.
+
+ Finally I added a test of TSS object lifetime management. Previously
+ it did a lot of calls without really checking to see if they worked.
+ It now counts the number of TSS objects created and the number deleted to
+ insure that every object created is actually deleted. For now a failure
+ of this check generates a warning rather than an error because I want
+ to see how this turns out on various platforms without adding a new
+ test failure right before upcoming beta release.
+
Fri Oct 15 01:28:58 2004 J.T. Conklin <jtc@acorntoolworks.com>
- * netsvcs/lib/Makefile.am:
+ * netsvcs/lib/Makefile.am:
- Changed to install netsvcs library.
+ Changed to install netsvcs library.
Fri Oct 15 06:52:12 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl>
@@ -12,11 +44,11 @@ Fri Oct 15 06:52:12 UTC 2004 Johnny Willemsen <jwillemsen@remedy.nl>
Thu Oct 14 21:03:00 2004 J.T. Conklin <jtc@acorntoolworks.com>
- * ace/CDR_Base.cpp:
- * ace/CDR_Base.inl:
+ * ace/CDR_Base.cpp:
+ * ace/CDR_Base.inl:
- Added AMD64 optimized versions of ACE_CDR::swap_{2, 4, 8}, and
- ACE_CDR::swap_{2, 4}_array.
+ Added AMD64 optimized versions of ACE_CDR::swap_{2, 4, 8}, and
+ ACE_CDR::swap_{2, 4}_array.
Thu Oct 14 08:07:36 2004 Chad Elliott <elliott_c@ociweb.com>
diff --git a/tests/TSS_Test.cpp b/tests/TSS_Test.cpp
index a148559c49a..14affcdd5aa 100644
--- a/tests/TSS_Test.cpp
+++ b/tests/TSS_Test.cpp
@@ -58,6 +58,9 @@ static u_int errors = 0;
// Static variables.
int Errno::flags_;
+int Errno::created_;
+int Errno::deleted_;
+
ACE_Thread_Mutex *Errno::lock_ = 0;
// This is our thread-specific error handler . . .
@@ -81,15 +84,17 @@ cleanup (void *ptr)
// old value is replaced. This function is intended to be
// used with Draft 6 and later threads, where it is called
// on thread termination with the thread-specific value.
-
- // Anyways, for whatever reason, the ACE_DEBUG causes a
- // core dump on LynxOS 2.5.0.
ACE_UNUSED_ARG (ptr);
#else /* ! ACE_HAS_PTHREADS_DRAFT4 */
- ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) in cleanup, ptr = %x\n"), ptr));
+ // Don't do this: ACE_DEBUG ((LM_DEBUG, ACE_TEXT ("(%t) in cleanup, ptr = %x\n"), ptr));
+ // The Log_Msg buffer is a TSS object, too, and it may be gone!
+ // if you must say something here try:
+ // ACE_OS::fprintf (stderr, ACE_TEXT("(%d) in cleanup, ptr = %x\n"), ACE_Thread::self(), ptr);
+ // and this:
+ // operator delete (ptr);
+ // is nonsense when applied to a void *! (even tho the compilers accept it????
+ delete static_cast <int *> (ptr);
#endif /* ! ACE_HAS_PTHREADS_DRAFT4 */
-
- operator delete (ptr);
}
// This worker function is the entry point for each thread.
@@ -245,6 +250,16 @@ worker (void *c)
# endif /* !(PTHREADS_DRAFT4 or 6) || defined (ACE_HAS_TSS_EMULATION) */
#endif /* ! __Lynx__ || ACE_HAS_TSS_EMULATION */
}
+ if (Errno::created () != Errno::deleted ())
+ {
+ //@@TODO: this should probably be promoted to an error rather than just a
+ // warning.
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Warning: Number created (%d) != number deleted (%d)\n"),
+ Errno::created (),
+ Errno::created ()
+ ));
+ }
return 0;
}
@@ -298,7 +313,7 @@ run_main (int, ACE_TCHAR *[])
delete tss_error;
Errno::deallocate_lock ();
-#else
+#else /* ACE_HAS_THREADS */
ACE_ERROR ((LM_INFO,
ACE_TEXT ("threads are not supported on this platform\n")));
#endif /* ACE_HAS_THREADS */
diff --git a/tests/TSS_Test_Errno.h b/tests/TSS_Test_Errno.h
index 26c0b0e0ae0..7d822a7099b 100644
--- a/tests/TSS_Test_Errno.h
+++ b/tests/TSS_Test_Errno.h
@@ -29,6 +29,17 @@ class Errno
// compiler "features" related to template instantiation... It is
// only used by TSS_Test.cpp.
public:
+ Errno()
+ {
+ ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_Mon, *Errno::lock_));
+ created_ += 1;
+ }
+ ~Errno()
+ {
+ ACE_MT (ACE_GUARD (ACE_Thread_Mutex, ace_Mon, *Errno::lock_));
+ deleted_ += 1;
+ }
+
int error (void) { return this->errno_; }
void error (int i) { this->errno_ = i; }
@@ -51,6 +62,16 @@ public:
return 0;
}
+ static int created (void)
+ {
+ return created_;
+ }
+
+ static int deleted (void)
+ {
+ return deleted_;
+ }
+
#if defined (ACE_HAS_THREADS)
static
ACE_Thread_Mutex *
@@ -72,6 +93,8 @@ private:
int lineno_;
static int flags_;
+ static int created_;
+ static int deleted_;
#if defined (ACE_HAS_THREADS)
// flags_ needs a lock.
static ACE_Thread_Mutex *lock_;