[Avida-cvs] [avida-svn] r837 - development/source/tools

brysonda@myxo.css.msu.edu brysonda at myxo.css.msu.edu
Fri Jul 14 19:17:23 PDT 2006


Author: brysonda
Date: 2006-07-14 22:17:23 -0400 (Fri, 14 Jul 2006)
New Revision: 837

Modified:
   development/source/tools/cThread.cc
   development/source/tools/cThread.h
Log:
Update cThread to actually initialize/destroy its internal mutex.  Not terribly detrimental in most cases, this mutex is a safe guard against race conditions within calls to Join and Stop, thus it should really be initialized.    Also the hope is that may fix some of the hangs within cAnalyzeJobQueue startup on buggy threading packages on older versions of Linux (<crosses fingers/>).

Modified: development/source/tools/cThread.cc
===================================================================
--- development/source/tools/cThread.cc	2006-07-14 18:42:37 UTC (rev 836)
+++ development/source/tools/cThread.cc	2006-07-15 02:17:23 UTC (rev 837)
@@ -11,6 +11,7 @@
 
 cThread::~cThread()
 {
+  pthread_mutex_destroy(&m_mutex);
 #ifndef WIN32_PTHREAD_HACK
   if (m_running) pthread_detach(m_thread);
 #endif

Modified: development/source/tools/cThread.h
===================================================================
--- development/source/tools/cThread.h	2006-07-14 18:42:37 UTC (rev 836)
+++ development/source/tools/cThread.h	2006-07-15 02:17:23 UTC (rev 837)
@@ -31,7 +31,7 @@
   cThread& operator=(const cThread&); // @not_implemented
 
 public:
-  cThread() : m_running(false) { ; }
+  cThread() : m_running(false) { pthread_mutex_init(&m_mutex, NULL); }
   virtual ~cThread();
   
   int Start();




More information about the Avida-cvs mailing list