[mpich2-commits] r5623 - mpich2/trunk/src/include

goodell at mcs.anl.gov goodell at mcs.anl.gov
Thu Oct 29 16:56:57 CDT 2009


Author: goodell
Date: 2009-10-29 16:56:57 -0500 (Thu, 29 Oct 2009)
New Revision: 5623

Modified:
   mpich2/trunk/src/include/mpiimpl.h
Log:
Never refcount builtin errhandlers.

Reviewed by robl at .

Modified: mpich2/trunk/src/include/mpiimpl.h
===================================================================
--- mpich2/trunk/src/include/mpiimpl.h	2009-10-29 21:56:55 UTC (rev 5622)
+++ mpich2/trunk/src/include/mpiimpl.h	2009-10-29 21:56:57 UTC (rev 5623)
@@ -644,10 +644,26 @@
 extern MPID_Errhandler MPID_Errhandler_builtin[];
 extern MPID_Errhandler MPID_Errhandler_direct[];
 
-#define MPIR_Errhandler_add_ref( _errhand ) \
-    do { MPIU_Object_add_ref( _errhand ); } while (0)
-#define MPIR_Errhandler_release_ref( _errhand, _inuse ) \
-    do { MPIU_Object_release_ref( _errhand, _inuse ); } while (0)
+/* We never reference count the builtin error handler objects, regardless of how
+ * we decide to reference count the other predefined objects.  If we get to the
+ * point where we never reference count *any* of the builtin objects then we
+ * should probably remove these checks and let them fall through to the checks
+ * for BUILTIN down in the MPIU_Object_* routines. */
+#define MPIR_Errhandler_add_ref( _errhand )                               \
+    do {                                                                  \
+        if (HANDLE_GET_KIND((_errhand)->handle) != HANDLE_KIND_BUILTIN) { \
+            MPIU_Object_add_ref( _errhand );                              \
+        }                                                                 \
+    } while (0)
+#define MPIR_Errhandler_release_ref( _errhand, _inuse )                   \
+    do {                                                                  \
+        if (HANDLE_GET_KIND((_errhand)->handle) != HANDLE_KIND_BUILTIN) { \
+            MPIU_Object_release_ref( (_errhand), (_inuse) );              \
+        }                                                                 \
+        else {                                                            \
+            *(_inuse) = 1;                                                \
+        }                                                                 \
+    } while (0)
 /* ------------------------------------------------------------------------- */
 
 /* ------------------------------------------------------------------------- */



More information about the mpich2-commits mailing list