summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelliott_c <ocielliottc@users.noreply.github.com>2004-11-10 18:50:08 +0000
committerelliott_c <ocielliottc@users.noreply.github.com>2004-11-10 18:50:08 +0000
commitae21faf3d414cfadba86eab6871ddf3cfd1eba62 (patch)
tree685d07b24db20251c3ae2b15b0ba6a22bc2590b3
parentd626f33e77054b47153536590e6cb4addbc270ca (diff)
downloadATCD-ae21faf3d414cfadba86eab6871ddf3cfd1eba62.tar.gz
ChangeLogTag: Wed Nov 10 12:42:45 2004 Chad Elliott <elliott_c@ociweb.com>
-rw-r--r--ChangeLog66
-rw-r--r--ace/OS_Errno.cpp9
-rw-r--r--ace/OS_Errno.h5
-rw-r--r--ace/Service_Repository.cpp77
-rw-r--r--ace/Service_Repository.h4
-rw-r--r--ace/Service_Repository.inl4
-rw-r--r--bin/MakeProjectCreator/config/rtscheduling.mpb2
-rw-r--r--tests/Priority_Task_Test.cpp2
8 files changed, 124 insertions, 45 deletions
diff --git a/ChangeLog b/ChangeLog
index 768861abac5..f065d9cc86c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,21 +1,71 @@
+Wed Nov 10 12:42:45 2004 Chad Elliott <elliott_c@ociweb.com>
+
+ * ace/OS_Errno.h:
+ * ace/OS_Errno.cpp:
+
+ Do not inline this code if building with debug enabled using gcc
+ on Solaris. If it is inlined, it can cause deadlocks during
+ static initialization.
+
+ * bin/MakeProjectCreator/config/rtscheduling.mpb:
+
+ The TAO_RTScheduler library links in the TAO_PortableServer
+ library, so this base project needs the portableserver base
+ project.
+
+ * tests/Priority_Task_Test.cpp:
+
+ Print out an informational message if we are unable to change
+ priority due to user privileges instead of an error.
+
+
+ Applying the following changes from Trevor Fields
+ (fields_t@ociweb.com):
+
+ Mon Oct 25 12:12:14 MST 2004 Trevor Fields <fields_t@ociweb.com>
+
+ * ace/Service_Repository.h:
+ * ace/Service_Repository.i:
+ * ace/Service_Repository.cpp:
+
+ Changed the lock from an ACE_Thread_Mutex to an
+ ACE_Recursive_Thread_Mutex. This was done to stop the
+ deadlock from occuring on Solaris with gcc (>3) non-optimized
+ builds.
+ The problem is that the dynamic library loading is being done
+ according to the link line, every time a variable is looked up.
+ This results in loading a new library while holding the Service
+ Repository lock resulting in a single threaded deadlock.
+ The problem manifests itself in executables that deadlock before
+ reaching main(). The ImR_Activator is one of the programs that
+ currently is broken by this problem.
+
+ Wed Sep 1 13:23:44 MST 2004 Trevor Fields <fields_t@ociweb.com>
+
+ * ace/Service_Repository.cpp:
+ Changed the insert method to delete a replaced service
+ after releasing the lock. This was done to prevent
+ deadlocks that were occuring on solaris with gcc > 3.2.1
+ in the debug mode.
+
Wed Nov 10 16:42:12 UTC 2004 Martin Corino <mcorino@remedy.nl>
- * include/makeinclude/platform_vxworks5.5.x.GNU:
- New platform configuration for VxWorks >= 5.5.1.
- This new file (should) work(s) for both the GNU and DIAB toolchains on
+ * include/makeinclude/platform_vxworks5.5.x.GNU:
+ New platform configuration for VxWorks >= 5.5.1.
+ This new file (should) work(s) for both the GNU and DIAB toolchains on
any host for any target:-)
Wed Nov 10 16:38:12 UTC 2004 Martin Corino <mcorino@remedy.nl>
- * ace/config-vxworks5.x.h:
- Added template specialization macros for DIAB builds.
+ * ace/config-vxworks5.x.h:
+ Added template specialization macros for DIAB builds.
Wed Nov 10 16:35:12 UTC 2004 Martin Corino <mcorino@remedy.nl>
* bin/MakeProjectCreator/templates/gnu.mpd:
- * include/makeinclude/rules.local.GNU:
- * include/makeinclude/wrapper_macros.GNU:
- Introduced use of ACE_MKDIR and MKDIR variables to better support
+ * include/makeinclude/rules.local.GNU:
+ * include/makeinclude/wrapper_macros.GNU:
+ Introduced use of ACE_MKDIR and MKDIR variables to better support
VxWorks 5.5.1 builds.
Wed Nov 10 07:10:12 2004 Chad Elliott <elliott_c@ociweb.com>
diff --git a/ace/OS_Errno.cpp b/ace/OS_Errno.cpp
index 59c6790b529..7e1d6f93cc0 100644
--- a/ace/OS_Errno.cpp
+++ b/ace/OS_Errno.cpp
@@ -5,7 +5,14 @@
ACE_RCSID(ace, OS_Errno, "$Id$")
-#if !defined (ACE_HAS_INLINED_OSCALLS)
+// Inlining this class on debug builds with gcc on Solaris can cause
+// deadlocks during static initialization.
+#if !defined (ACE_HAS_INLINED_OSCALLS) || \
+ (defined (__GNUG__) && defined (__sun__) && !defined (ACE_NDEBUG))
+# if defined (ACE_INLINE)
+# undef ACE_INLINE
+# endif /* ACE_INLINE */
+# define ACE_INLINE
# include "ace/OS_Errno.inl"
#endif /* ACE_HAS_INLINED_OS_CALLS */
diff --git a/ace/OS_Errno.h b/ace/OS_Errno.h
index 7318147ae37..8d0c53e233a 100644
--- a/ace/OS_Errno.h
+++ b/ace/OS_Errno.h
@@ -77,7 +77,10 @@ private:
int error_;
};
-#if defined (ACE_HAS_INLINED_OSCALLS)
+// Inlining this class on debug builds with gcc on Solaris can cause
+// deadlocks during static initialization.
+#if defined (ACE_HAS_INLINED_OSCALLS) && \
+ (!defined (__GNUG__) || !defined (__sun__) || defined (ACE_NDEBUG))
# if defined (ACE_INLINE)
# undef ACE_INLINE
# endif /* ACE_INLINE */
diff --git a/ace/Service_Repository.cpp b/ace/Service_Repository.cpp
index a84a4874785..4952f95fc1b 100644
--- a/ace/Service_Repository.cpp
+++ b/ace/Service_Repository.cpp
@@ -135,7 +135,7 @@ int
ACE_Service_Repository::fini (void)
{
ACE_TRACE ("ACE_Service_Repository::fini");
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
int retval = 0;
if (this->service_vector_ != 0)
@@ -170,7 +170,7 @@ int
ACE_Service_Repository::close (void)
{
ACE_TRACE ("ACE_Service_Repository::close");
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
if (this->service_vector_ != 0)
{
@@ -248,7 +248,7 @@ ACE_Service_Repository::find (const ACE_TCHAR name[],
int ignore_suspended)
{
ACE_TRACE ("ACE_Service_Repository::find");
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
return this->find_i (name, srp, ignore_suspended);
}
@@ -261,37 +261,56 @@ int
ACE_Service_Repository::insert (const ACE_Service_Type *sr)
{
ACE_TRACE ("ACE_Service_Repository::insert");
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
- int i;
+ int return_value = -1;
+ ACE_Service_Type *s = 0;
- // Check to see if this is a duplicate.
- for (i = 0; i < this->current_size_; i++)
- if (ACE_OS::strcmp (sr->name (),
- this->service_vector_[i]->name ()) == 0)
- break;
+ {
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
+ int i;
+
+ // Check to see if this is a duplicate.
+ for (i = 0; i < this->current_size_; i++)
+ if (ACE_OS::strcmp (sr->name (),
+ this->service_vector_[i]->name ()) == 0)
+ break;
+
+ // Replacing an existing entry
+ if (i < this->current_size_)
+ {
+ // Check for self-assignment...
+ if (sr == this->service_vector_[i])
+ {
+ return_value = 0;
+ }
+ else
+ {
+ s = ACE_const_cast (ACE_Service_Type *,
+ this->service_vector_[i]);
+ this->service_vector_[i] = sr;
+ return_value = 0;
+ }
+ }
+ // Adding a new entry.
+ else if (i < this->total_size_)
+ {
+ this->service_vector_[i] = sr;
+ this->current_size_++;
+ return_value = 0;
+ }
+ }
- // Replacing an existing entry
- if (i < this->current_size_)
+ // delete outside the lock
+ if (s != 0)
{
- // Check for self-assignment...
- if (sr == this->service_vector_[i])
- return 0;
- ACE_Service_Type *s = ACE_const_cast (ACE_Service_Type *,
- this->service_vector_[i]);
delete s;
- this->service_vector_[i] = sr;
- return 0;
}
- // Adding a new entry.
- else if (i < this->total_size_)
+
+ if (return_value == -1)
{
- this->service_vector_[i] = sr;
- this->current_size_++;
- return 0;
+ ACE_OS::last_error (ENOSPC);
}
- ACE_OS::last_error (ENOSPC);
- return -1;
+ return return_value;
}
// Re-resume a service that was previously suspended.
@@ -301,7 +320,7 @@ ACE_Service_Repository::resume (const ACE_TCHAR name[],
const ACE_Service_Type **srp)
{
ACE_TRACE ("ACE_Service_Repository::resume");
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
int i = this->find_i (name, srp, 0);
@@ -319,7 +338,7 @@ ACE_Service_Repository::suspend (const ACE_TCHAR name[],
const ACE_Service_Type **srp)
{
ACE_TRACE ("ACE_Service_Repository::suspend");
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
int i = this->find_i (name, srp, 0);
if (i == -1)
@@ -340,7 +359,7 @@ ACE_Service_Repository::remove (const ACE_TCHAR name[], ACE_Service_Type **ps)
ACE_TRACE ("ACE_Service_Repository::remove");
ACE_Service_Type *s = 0;
{
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, this->lock_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, this->lock_, -1));
int i = this->find_i (name, 0, 0);
if (i == -1)
diff --git a/ace/Service_Repository.h b/ace/Service_Repository.h
index 48b13290f5a..5479f59238e 100644
--- a/ace/Service_Repository.h
+++ b/ace/Service_Repository.h
@@ -22,7 +22,7 @@
#endif /* ACE_LACKS_PRAGMA_ONCE */
#include "ace/Default_Constants.h"
-#include "ace/Thread_Mutex.h"
+#include "ace/Recursive_Thread_Mutex.h"
class ACE_Service_Type;
@@ -153,7 +153,7 @@ private:
#if defined (ACE_MT_SAFE) && (ACE_MT_SAFE != 0)
/// Synchronization variable for the MT_SAFE Repository
- ACE_Thread_Mutex lock_;
+ ACE_Recursive_Thread_Mutex lock_;
#endif /* ACE_MT_SAFE */
};
diff --git a/ace/Service_Repository.inl b/ace/Service_Repository.inl
index 6872433596e..f6e13326eab 100644
--- a/ace/Service_Repository.inl
+++ b/ace/Service_Repository.inl
@@ -15,7 +15,7 @@ ACE_INLINE int
ACE_Service_Repository::current_size (void) const
{
ACE_TRACE ("ACE_Service_Repository::current_size");
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->lock_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, (ACE_Recursive_Thread_Mutex &) this->lock_, -1));
return this->current_size_;
}
@@ -26,7 +26,7 @@ ACE_INLINE int
ACE_Service_Repository::total_size (void) const
{
ACE_TRACE ("ACE_Service_Repository::total_size");
- ACE_MT (ACE_GUARD_RETURN (ACE_Thread_Mutex, ace_mon, (ACE_Thread_Mutex &) this->lock_, -1));
+ ACE_MT (ACE_GUARD_RETURN (ACE_Recursive_Thread_Mutex, ace_mon, (ACE_Recursive_Thread_Mutex &) this->lock_, -1));
return this->total_size_;
}
diff --git a/bin/MakeProjectCreator/config/rtscheduling.mpb b/bin/MakeProjectCreator/config/rtscheduling.mpb
index 2ade021b316..9dc026b6087 100644
--- a/bin/MakeProjectCreator/config/rtscheduling.mpb
+++ b/bin/MakeProjectCreator/config/rtscheduling.mpb
@@ -1,7 +1,7 @@
// -*- MPC -*-
// $Id$
-project : rtcorba {
+project : rtcorba, portableserver {
after += RTScheduler
libs += TAO_RTScheduler
}
diff --git a/tests/Priority_Task_Test.cpp b/tests/Priority_Task_Test.cpp
index 19b58828ad4..3c4cf5c7bd6 100644
--- a/tests/Priority_Task_Test.cpp
+++ b/tests/Priority_Task_Test.cpp
@@ -113,7 +113,7 @@ Priority_Task::open (void *arg)
{
#if !defined (ACE_HAS_WINCE)
if (ACE_OS::last_error () == EPERM)
- ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_ERROR_RETURN ((LM_INFO,
ACE_TEXT ("Insufficient privilege to run this test.\n")),
-1);
else