[mpich-commits] [mpich] MPICH primary repository branch, master, updated. v3.2b4-125-g6504ef7

Service Account noreply at mpich.org
Sat Aug 15 14:57:52 CDT 2015


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "MPICH primary repository".

The branch, master has been updated
       via  6504ef78086bb5ab1433b66dc527fc921cbbfc6a (commit)
       via  964b32d0180840e868cc10b28180c78a3e10d87f (commit)
       via  94c2de448a2e9a598787d41cd948335eb756778a (commit)
       via  8c1db8c508ae2cba9ab4ef53ce5018a2e61b8266 (commit)
       via  45bfb114d45fb5dbeeeaa80e4d975ff0b8a267a3 (commit)
       via  8c3a1def822759e116df9a614d64b8012d3794a9 (commit)
       via  c7ff730a5252a06f524ae1a72914b9967a27906c (commit)
       via  5f2cb148b330cfe2e46e22af8549c92e68e68de2 (commit)
       via  4a706ae7ad15a14f6a759d5df207f5e00d4138f3 (commit)
       via  05a87d2a5f7043ca879da13d3ac4876218e01c38 (commit)
       via  395038058b875d202f765f19fada7a0f61662ee7 (commit)
       via  da5d528c230eb2f1ef8897e4070a9fd47f68d849 (commit)
      from  f3984d8e88e84aedbdb776620833c2068b6bfe15 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
http://git.mpich.org/mpich.git/commitdiff/6504ef78086bb5ab1433b66dc527fc921cbbfc6a

commit 6504ef78086bb5ab1433b66dc527fc921cbbfc6a
Author: Pavan Balaji <balaji at anl.gov>
Date:   Fri Aug 14 22:52:17 2015 -0500

    Use macros instead of direct mutex names to make the code cleaner.
    
    No reviewer.

diff --git a/src/binding/fortran/use_mpi/create_f90_complex.c b/src/binding/fortran/use_mpi/create_f90_complex.c
index b65e7cb..67981cd 100644
--- a/src/binding/fortran/use_mpi/create_f90_complex.c
+++ b/src/binding/fortran/use_mpi/create_f90_complex.c
@@ -80,7 +80,7 @@ int MPI_Type_create_f90_complex( int precision, int range, MPI_Datatype *newtype
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_F90_COMPLEX);
 
     /* ... body of routine ...  */
@@ -126,7 +126,7 @@ int MPI_Type_create_f90_complex( int precision, int range, MPI_Datatype *newtype
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_F90_COMPLEX);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 fn_fail:
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/binding/fortran/use_mpi/create_f90_int.c b/src/binding/fortran/use_mpi/create_f90_int.c
index f2a8ad9..4bff608 100644
--- a/src/binding/fortran/use_mpi/create_f90_int.c
+++ b/src/binding/fortran/use_mpi/create_f90_int.c
@@ -74,7 +74,7 @@ int MPI_Type_create_f90_integer( int range, MPI_Datatype *newtype )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_F90_INTEGER);
 
     /* ... body of routine ...  */
@@ -109,7 +109,7 @@ int MPI_Type_create_f90_integer( int range, MPI_Datatype *newtype )
     /* ... end of body of routine ... */
  fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_F90_INTEGER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
  fn_fail:
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/binding/fortran/use_mpi/create_f90_real.c b/src/binding/fortran/use_mpi/create_f90_real.c
index 5e3a68f..11b5ebd 100644
--- a/src/binding/fortran/use_mpi/create_f90_real.c
+++ b/src/binding/fortran/use_mpi/create_f90_real.c
@@ -79,7 +79,7 @@ int MPI_Type_create_f90_real( int precision, int range, MPI_Datatype *newtype )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_F90_REAL);
 
     /* ... body of routine ...  */
@@ -123,7 +123,7 @@ int MPI_Type_create_f90_real( int precision, int range, MPI_Datatype *newtype )
     /* ... end of body of routine ... */
 
  fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_F90_REAL);
     return mpi_errno;
  fn_fail:
diff --git a/src/glue/romio/glue_romio.c b/src/glue/romio/glue_romio.c
index 0c8c5f6..87a3125 100644
--- a/src/glue/romio/glue_romio.c
+++ b/src/glue/romio/glue_romio.c
@@ -41,12 +41,12 @@ int MPIR_Ext_assert_fail(const char *cond, const char *file_name, int line_num)
  * threading strategies. */
 void MPIR_Ext_cs_enter_global(void)
 {
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 }
 
 void MPIR_Ext_cs_exit_global(void)
 {
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 }
 
 /* This routine is for a thread to yield control when the thread is waiting for
@@ -55,7 +55,7 @@ void MPIR_Ext_cs_exit_global(void)
 void MPIR_Ext_cs_yield_global_if_progress_blocked(void)
 {
     /* TODO: check whether the progress engine is blocked */
-    MPID_THREAD_CS_YIELD(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_YIELD(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 }
 
 /* will consider MPI_DATATYPE_NULL to be an error */
diff --git a/src/mpi/attr/attr_delete.c b/src/mpi/attr/attr_delete.c
index fa93ba3..42bd6ea 100644
--- a/src/mpi/attr/attr_delete.c
+++ b/src/mpi/attr/attr_delete.c
@@ -62,7 +62,7 @@ int MPI_Attr_delete(MPI_Comm comm, int keyval)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ATTR_DELETE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -105,7 +105,7 @@ int MPI_Attr_delete(MPI_Comm comm, int keyval)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ATTR_DELETE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/attr_get.c b/src/mpi/attr/attr_get.c
index a318284..e75baa8 100644
--- a/src/mpi/attr/attr_get.c
+++ b/src/mpi/attr/attr_get.c
@@ -80,7 +80,7 @@ int MPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ATTR_GET);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -130,7 +130,7 @@ int MPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ATTR_GET);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/attr_put.c b/src/mpi/attr/attr_put.c
index adb491b..83b084b 100644
--- a/src/mpi/attr/attr_put.c
+++ b/src/mpi/attr/attr_put.c
@@ -79,7 +79,7 @@ int MPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ATTR_PUT);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -121,7 +121,7 @@ int MPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ATTR_PUT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/attrutil.c b/src/mpi/attr/attrutil.c
index 656915d..ca6b166 100644
--- a/src/mpi/attr/attrutil.c
+++ b/src/mpi/attr/attrutil.c
@@ -327,9 +327,9 @@ MPIR_Attr_copy_c_proxy(
     /* user functions might call other MPI functions, so we need to
      * release the lock here. This is safe to do as GLOBAL is not at
      * all recursive in our implementation. */
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     ret = user_function(handle, keyval, extra_state, attrib_val, attrib_copy, flag);
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return ret;
 }
@@ -357,9 +357,9 @@ MPIR_Attr_delete_c_proxy(
     /* user functions might call other MPI functions, so we need to
      * release the lock here. This is safe to do as GLOBAL is not at
      * all recursive in our implementation. */
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     ret = user_function(handle, keyval, attrib_val, extra_state);
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return ret;
 }
diff --git a/src/mpi/attr/comm_create_keyval.c b/src/mpi/attr/comm_create_keyval.c
index 379d572..72a2762 100644
--- a/src/mpi/attr/comm_create_keyval.c
+++ b/src/mpi/attr/comm_create_keyval.c
@@ -130,7 +130,7 @@ int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function *comm_copy_attr_fn,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_CREATE_KEYVAL);
 
     /* Validate parameters and objects (post conversion) */
@@ -153,7 +153,7 @@ int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function *comm_copy_attr_fn,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_CREATE_KEYVAL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/comm_delete_attr.c b/src/mpi/attr/comm_delete_attr.c
index 4a2a2f3..27232e9 100644
--- a/src/mpi/attr/comm_delete_attr.c
+++ b/src/mpi/attr/comm_delete_attr.c
@@ -114,7 +114,7 @@ int MPI_Comm_delete_attr(MPI_Comm comm, int comm_keyval)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_DELETE_ATTR);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -159,7 +159,7 @@ int MPI_Comm_delete_attr(MPI_Comm comm, int comm_keyval)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_DELETE_ATTR);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/comm_free_keyval.c b/src/mpi/attr/comm_free_keyval.c
index 69e5973..1701603 100644
--- a/src/mpi/attr/comm_free_keyval.c
+++ b/src/mpi/attr/comm_free_keyval.c
@@ -78,7 +78,7 @@ int MPI_Comm_free_keyval(int *comm_keyval)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_FREE_KEYVAL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -122,7 +122,7 @@ int MPI_Comm_free_keyval(int *comm_keyval)
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_FREE_KEYVAL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/attr/comm_get_attr.c b/src/mpi/attr/comm_get_attr.c
index a3f22a2..2ea495d 100644
--- a/src/mpi/attr/comm_get_attr.c
+++ b/src/mpi/attr/comm_get_attr.c
@@ -300,9 +300,9 @@ int MPIR_CommGetAttr_fort(MPI_Comm comm, int comm_keyval, void *attribute_val,
 {
     int mpi_errno;
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     mpi_errno = MPIR_CommGetAttr(comm, comm_keyval, attribute_val, flag, outAttrType);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return mpi_errno;
 }
@@ -355,7 +355,7 @@ int MPI_Comm_get_attr(MPI_Comm comm, int comm_keyval, void *attribute_val,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_GET_ATTR);
 
     /* Instead, ask for a desired type. */
@@ -366,7 +366,7 @@ int MPI_Comm_get_attr(MPI_Comm comm, int comm_keyval, void *attribute_val,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_GET_ATTR);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/comm_set_attr.c b/src/mpi/attr/comm_set_attr.c
index 558a883..0a46a08 100644
--- a/src/mpi/attr/comm_set_attr.c
+++ b/src/mpi/attr/comm_set_attr.c
@@ -115,7 +115,7 @@ int MPIR_CommSetAttr( MPI_Comm comm, int comm_keyval, void *attribute_val,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_COMM_SET_ATTR);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -161,7 +161,7 @@ int MPIR_CommSetAttr( MPI_Comm comm, int comm_keyval, void *attribute_val,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_COMM_SET_ATTR);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
@@ -222,7 +222,7 @@ int MPI_Comm_set_attr(MPI_Comm comm, int comm_keyval, void *attribute_val)
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_SET_ATTR);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_SET_ATTR);
 
      /* Validate parameters, especially handles needing to be converted */
@@ -267,7 +267,7 @@ int MPI_Comm_set_attr(MPI_Comm comm, int comm_keyval, void *attribute_val)
 
  fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_SET_ATTR);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/keyval_create.c b/src/mpi/attr/keyval_create.c
index 8014942..bb99160 100644
--- a/src/mpi/attr/keyval_create.c
+++ b/src/mpi/attr/keyval_create.c
@@ -76,7 +76,7 @@ int MPI_Keyval_create(MPI_Copy_function *copy_fn,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_KEYVAL_CREATE);
 
     /* Validate parameters and objects (post conversion) */
@@ -99,7 +99,7 @@ int MPI_Keyval_create(MPI_Copy_function *copy_fn,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_KEYVAL_CREATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/keyval_free.c b/src/mpi/attr/keyval_free.c
index 560627c..af36597 100644
--- a/src/mpi/attr/keyval_free.c
+++ b/src/mpi/attr/keyval_free.c
@@ -63,7 +63,7 @@ int MPI_Keyval_free(int *keyval)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_KEYVAL_FREE);
 #   ifdef HAVE_ERROR_CHECKING
     {
@@ -101,7 +101,7 @@ int MPI_Keyval_free(int *keyval)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_KEYVAL_FREE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/type_create_keyval.c b/src/mpi/attr/type_create_keyval.c
index 76df18b..b680e77 100644
--- a/src/mpi/attr/type_create_keyval.c
+++ b/src/mpi/attr/type_create_keyval.c
@@ -81,7 +81,7 @@ int MPI_Type_create_keyval(MPI_Type_copy_attr_function *type_copy_attr_fn,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_KEYVAL);
     
     /* Validate parameters and objects (post conversion) */
@@ -128,7 +128,7 @@ int MPI_Type_create_keyval(MPI_Type_copy_attr_function *type_copy_attr_fn,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_KEYVAL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/type_delete_attr.c b/src/mpi/attr/type_delete_attr.c
index 639a586..cfd26b6 100644
--- a/src/mpi/attr/type_delete_attr.c
+++ b/src/mpi/attr/type_delete_attr.c
@@ -61,7 +61,7 @@ int MPI_Type_delete_attr(MPI_Datatype datatype, int type_keyval)
     
     /* The thread lock prevents a valid attr delete on the same datatype
        but in a different thread from causing problems */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_DELETE_ATTR);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -145,7 +145,7 @@ int MPI_Type_delete_attr(MPI_Datatype datatype, int type_keyval)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_DELETE_ATTR);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/type_free_keyval.c b/src/mpi/attr/type_free_keyval.c
index e29ae1b..a7b070a 100644
--- a/src/mpi/attr/type_free_keyval.c
+++ b/src/mpi/attr/type_free_keyval.c
@@ -58,7 +58,7 @@ int MPI_Type_free_keyval(int *type_keyval)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_FREE_KEYVAL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -106,7 +106,7 @@ int MPI_Type_free_keyval(int *type_keyval)
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_FREE_KEYVAL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/attr/type_get_attr.c b/src/mpi/attr/type_get_attr.c
index e3958ab..851226e 100644
--- a/src/mpi/attr/type_get_attr.c
+++ b/src/mpi/attr/type_get_attr.c
@@ -42,7 +42,7 @@ int MPIR_TypeGetAttr( MPI_Datatype datatype, int type_keyval, void *attribute_va
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_TYPE_GET_ATTR);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -130,7 +130,7 @@ int MPIR_TypeGetAttr( MPI_Datatype datatype, int type_keyval, void *attribute_va
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_TYPE_GET_ATTR);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/attr/type_set_attr.c b/src/mpi/attr/type_set_attr.c
index dfd118f..1027311 100644
--- a/src/mpi/attr/type_set_attr.c
+++ b/src/mpi/attr/type_set_attr.c
@@ -42,7 +42,7 @@ int MPIR_TypeSetAttr(MPI_Datatype datatype, int type_keyval, void *attribute_val
     
     /* The thread lock prevents a valid attr delete on the same datatype
        but in a different thread from causing problems */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_TYPE_SET_ATTR);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -141,7 +141,7 @@ int MPIR_TypeSetAttr(MPI_Datatype datatype, int type_keyval, void *attribute_val
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_TYPE_SET_ATTR);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/win_create_keyval.c b/src/mpi/attr/win_create_keyval.c
index a533189..02f4868 100644
--- a/src/mpi/attr/win_create_keyval.c
+++ b/src/mpi/attr/win_create_keyval.c
@@ -81,7 +81,7 @@ int MPI_Win_create_keyval(MPI_Win_copy_attr_function *win_copy_attr_fn,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_CREATE_KEYVAL);
 
     /* Validate parameters and objects (post conversion) */
@@ -124,7 +124,7 @@ int MPI_Win_create_keyval(MPI_Win_copy_attr_function *win_copy_attr_fn,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_CREATE_KEYVAL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/win_delete_attr.c b/src/mpi/attr/win_delete_attr.c
index 710da70..b035f94 100644
--- a/src/mpi/attr/win_delete_attr.c
+++ b/src/mpi/attr/win_delete_attr.c
@@ -62,7 +62,7 @@ int MPI_Win_delete_attr(MPI_Win win, int win_keyval)
     
     /* The thread lock prevents a valid attr delete on the same window
        but in a different thread from causing problems */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_DELETE_ATTR);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -144,7 +144,7 @@ int MPI_Win_delete_attr(MPI_Win win, int win_keyval)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_DELETE_ATTR);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/win_free_keyval.c b/src/mpi/attr/win_free_keyval.c
index 4d76a1a..573cf7d 100644
--- a/src/mpi/attr/win_free_keyval.c
+++ b/src/mpi/attr/win_free_keyval.c
@@ -59,7 +59,7 @@ int MPI_Win_free_keyval(int *win_keyval)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_FREE_KEYVAL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -107,7 +107,7 @@ int MPI_Win_free_keyval(int *win_keyval)
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_FREE_KEYVAL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/attr/win_get_attr.c b/src/mpi/attr/win_get_attr.c
index ea88525..d40ee7f 100644
--- a/src/mpi/attr/win_get_attr.c
+++ b/src/mpi/attr/win_get_attr.c
@@ -38,7 +38,7 @@ int MPIR_WinGetAttr( MPI_Win win, int win_keyval, void *attribute_val,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_WIN_GET_ATTR);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -198,7 +198,7 @@ int MPIR_WinGetAttr( MPI_Win win, int win_keyval, void *attribute_val,
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_WIN_GET_ATTR);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/attr/win_set_attr.c b/src/mpi/attr/win_set_attr.c
index 2d66409..f36c9c1 100644
--- a/src/mpi/attr/win_set_attr.c
+++ b/src/mpi/attr/win_set_attr.c
@@ -42,7 +42,7 @@ int MPIR_WinSetAttr( MPI_Win win, int win_keyval, void *attribute_val,
     
     /* The thread lock prevents a valid attr delete on the same window
        but in a different thread from causing problems */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_WIN_SET_ATTR);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -147,7 +147,7 @@ int MPIR_WinSetAttr( MPI_Win win, int win_keyval, void *attribute_val,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_WIN_SET_ATTR);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex); 
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX); 
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/allgather.c b/src/mpi/coll/allgather.c
index a61a089..9d138fc 100644
--- a/src/mpi/coll/allgather.c
+++ b/src/mpi/coll/allgather.c
@@ -907,7 +907,7 @@ int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_ALLGATHER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -989,7 +989,7 @@ int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_ALLGATHER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/allgatherv.c b/src/mpi/coll/allgatherv.c
index bc976b8..0bbf12d 100644
--- a/src/mpi/coll/allgatherv.c
+++ b/src/mpi/coll/allgatherv.c
@@ -1018,7 +1018,7 @@ int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_ALLGATHERV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -1111,7 +1111,7 @@ int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_ALLGATHERV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/allreduce.c b/src/mpi/coll/allreduce.c
index c6cdf94..e6b11bf 100644
--- a/src/mpi/coll/allreduce.c
+++ b/src/mpi/coll/allreduce.c
@@ -821,7 +821,7 @@ int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_ALLREDUCE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -896,7 +896,7 @@ int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_ALLREDUCE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/alltoall.c b/src/mpi/coll/alltoall.c
index ea52a6d..4cda343 100644
--- a/src/mpi/coll/alltoall.c
+++ b/src/mpi/coll/alltoall.c
@@ -650,7 +650,7 @@ int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_ALLTOALL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -726,7 +726,7 @@ int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_ALLTOALL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/alltoallv.c b/src/mpi/coll/alltoallv.c
index 8f5945c..23b6a57 100644
--- a/src/mpi/coll/alltoallv.c
+++ b/src/mpi/coll/alltoallv.c
@@ -441,7 +441,7 @@ int MPI_Alltoallv(const void *sendbuf, const int *sendcounts,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_ALLTOALLV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -533,7 +533,7 @@ int MPI_Alltoallv(const void *sendbuf, const int *sendcounts,
 
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_ALLTOALLV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/alltoallw.c b/src/mpi/coll/alltoallw.c
index 0335f85..89e426e 100644
--- a/src/mpi/coll/alltoallw.c
+++ b/src/mpi/coll/alltoallw.c
@@ -436,7 +436,7 @@ int MPI_Alltoallw(const void *sendbuf, const int sendcounts[],
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_ALLTOALLW);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -539,7 +539,7 @@ int MPI_Alltoallw(const void *sendbuf, const int sendcounts[],
 
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_ALLTOALLW);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/barrier.c b/src/mpi/coll/barrier.c
index a76d881..2a0bbce 100644
--- a/src/mpi/coll/barrier.c
+++ b/src/mpi/coll/barrier.c
@@ -375,7 +375,7 @@ int MPI_Barrier( MPI_Comm comm )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_BARRIER);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -414,7 +414,7 @@ int MPI_Barrier( MPI_Comm comm )
 
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_BARRIER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/bcast.c b/src/mpi/coll/bcast.c
index 1bbbcb4..da6bb05 100644
--- a/src/mpi/coll/bcast.c
+++ b/src/mpi/coll/bcast.c
@@ -1530,7 +1530,7 @@ int MPI_Bcast( void *buffer, int count, MPI_Datatype datatype, int root,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_BCAST);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -1589,7 +1589,7 @@ int MPI_Bcast( void *buffer, int count, MPI_Datatype datatype, int root,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_BCAST);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/exscan.c b/src/mpi/coll/exscan.c
index cf9ad79..f387b21 100644
--- a/src/mpi/coll/exscan.c
+++ b/src/mpi/coll/exscan.c
@@ -310,7 +310,7 @@ int MPI_Exscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_EXSCAN);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -389,7 +389,7 @@ int MPI_Exscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
     
   fn_exit:    
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_EXSCAN);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/gather.c b/src/mpi/coll/gather.c
index 47f7315..5d87714 100644
--- a/src/mpi/coll/gather.c
+++ b/src/mpi/coll/gather.c
@@ -779,7 +779,7 @@ int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_GATHER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -893,7 +893,7 @@ int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_GATHER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/gatherv.c b/src/mpi/coll/gatherv.c
index 51c3756..a2da9a1 100644
--- a/src/mpi/coll/gatherv.c
+++ b/src/mpi/coll/gatherv.c
@@ -292,7 +292,7 @@ int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_GATHERV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -424,7 +424,7 @@ int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_GATHERV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/iallgather.c b/src/mpi/coll/iallgather.c
index 58da4a8..7a4257c 100644
--- a/src/mpi/coll/iallgather.c
+++ b/src/mpi/coll/iallgather.c
@@ -667,7 +667,7 @@ int MPI_Iallgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IALLGATHER);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IALLGATHER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -739,7 +739,7 @@ int MPI_Iallgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IALLGATHER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/iallgatherv.c b/src/mpi/coll/iallgatherv.c
index 2ba36c6..896dba4 100644
--- a/src/mpi/coll/iallgatherv.c
+++ b/src/mpi/coll/iallgatherv.c
@@ -771,7 +771,7 @@ int MPI_Iallgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, v
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IALLGATHERV);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IALLGATHERV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -851,7 +851,7 @@ int MPI_Iallgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, v
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IALLGATHERV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/iallreduce.c b/src/mpi/coll/iallreduce.c
index d4c4d01..b91f148 100644
--- a/src/mpi/coll/iallreduce.c
+++ b/src/mpi/coll/iallreduce.c
@@ -723,7 +723,7 @@ int MPI_Iallreduce(const void *sendbuf, void *recvbuf, int count,
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IALLREDUCE);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IALLREDUCE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -796,7 +796,7 @@ int MPI_Iallreduce(const void *sendbuf, void *recvbuf, int count,
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IALLREDUCE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ialltoall.c b/src/mpi/coll/ialltoall.c
index d319cde..0cbfa11 100644
--- a/src/mpi/coll/ialltoall.c
+++ b/src/mpi/coll/ialltoall.c
@@ -596,7 +596,7 @@ int MPI_Ialltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IALLTOALL);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IALLTOALL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -670,7 +670,7 @@ int MPI_Ialltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IALLTOALL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ialltoallv.c b/src/mpi/coll/ialltoallv.c
index a811cda..3a26f0f 100644
--- a/src/mpi/coll/ialltoallv.c
+++ b/src/mpi/coll/ialltoallv.c
@@ -329,7 +329,7 @@ int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispl
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IALLTOALLV);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IALLTOALLV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -405,7 +405,7 @@ int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispl
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IALLTOALLV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ialltoallw.c b/src/mpi/coll/ialltoallw.c
index b42992a..398a440 100644
--- a/src/mpi/coll/ialltoallw.c
+++ b/src/mpi/coll/ialltoallw.c
@@ -334,7 +334,7 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IALLTOALLW);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IALLTOALLW);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -393,7 +393,7 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IALLTOALLW);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ibarrier.c b/src/mpi/coll/ibarrier.c
index 2176658..9319416 100644
--- a/src/mpi/coll/ibarrier.c
+++ b/src/mpi/coll/ibarrier.c
@@ -250,7 +250,7 @@ int MPI_Ibarrier(MPI_Comm comm, MPI_Request *request)
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IBARRIER);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IBARRIER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -292,7 +292,7 @@ int MPI_Ibarrier(MPI_Comm comm, MPI_Request *request)
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IBARRIER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ibcast.c b/src/mpi/coll/ibcast.c
index ae985d3..529aa1b 100644
--- a/src/mpi/coll/ibcast.c
+++ b/src/mpi/coll/ibcast.c
@@ -932,7 +932,7 @@ int MPI_Ibcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Com
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IBCAST);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IBCAST);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -986,7 +986,7 @@ int MPI_Ibcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Com
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IBCAST);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/iexscan.c b/src/mpi/coll/iexscan.c
index aca8fed..4d489c0 100644
--- a/src/mpi/coll/iexscan.c
+++ b/src/mpi/coll/iexscan.c
@@ -261,7 +261,7 @@ int MPI_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype data
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IEXSCAN);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IEXSCAN);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -327,7 +327,7 @@ int MPI_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype data
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IEXSCAN);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/igather.c b/src/mpi/coll/igather.c
index 9907801..eb8c63f 100644
--- a/src/mpi/coll/igather.c
+++ b/src/mpi/coll/igather.c
@@ -593,7 +593,7 @@ int MPI_Igather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IGATHER);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IGATHER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -715,7 +715,7 @@ int MPI_Igather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IGATHER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/igatherv.c b/src/mpi/coll/igatherv.c
index b636e25..fa4f367 100644
--- a/src/mpi/coll/igatherv.c
+++ b/src/mpi/coll/igatherv.c
@@ -193,7 +193,7 @@ int MPI_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IGATHERV);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IGATHERV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -325,7 +325,7 @@ int MPI_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IGATHERV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ired_scat.c b/src/mpi/coll/ired_scat.c
index 916d325..70617e5 100644
--- a/src/mpi/coll/ired_scat.c
+++ b/src/mpi/coll/ired_scat.c
@@ -1089,7 +1089,7 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IREDUCE_SCATTER);
     i = 0;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IREDUCE_SCATTER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -1159,7 +1159,7 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IREDUCE_SCATTER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ired_scat_block.c b/src/mpi/coll/ired_scat_block.c
index 8df4092..067d397 100644
--- a/src/mpi/coll/ired_scat_block.c
+++ b/src/mpi/coll/ired_scat_block.c
@@ -992,7 +992,7 @@ int MPI_Ireduce_scatter_block(const void *sendbuf, void *recvbuf,
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IREDUCE_SCATTER_BLOCK);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IREDUCE_SCATTER_BLOCK);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -1057,7 +1057,7 @@ int MPI_Ireduce_scatter_block(const void *sendbuf, void *recvbuf,
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IREDUCE_SCATTER_BLOCK);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ireduce.c b/src/mpi/coll/ireduce.c
index 0c529b7..e208727 100644
--- a/src/mpi/coll/ireduce.c
+++ b/src/mpi/coll/ireduce.c
@@ -840,7 +840,7 @@ int MPI_Ireduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype data
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IREDUCE);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IREDUCE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -922,7 +922,7 @@ int MPI_Ireduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype data
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IREDUCE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/iscan.c b/src/mpi/coll/iscan.c
index 2374918..4acd698 100644
--- a/src/mpi/coll/iscan.c
+++ b/src/mpi/coll/iscan.c
@@ -395,7 +395,7 @@ int MPI_Iscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype dataty
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_ISCAN);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ISCAN);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -464,7 +464,7 @@ int MPI_Iscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype dataty
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ISCAN);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/iscatter.c b/src/mpi/coll/iscatter.c
index ef23f87..d118e62 100644
--- a/src/mpi/coll/iscatter.c
+++ b/src/mpi/coll/iscatter.c
@@ -627,7 +627,7 @@ int MPI_Iscatter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_ISCATTER);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ISCATTER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -737,7 +737,7 @@ int MPI_Iscatter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ISCATTER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/iscatterv.c b/src/mpi/coll/iscatterv.c
index a46ead2..aa3c3b8 100644
--- a/src/mpi/coll/iscatterv.c
+++ b/src/mpi/coll/iscatterv.c
@@ -199,7 +199,7 @@ int MPI_Iscatterv(const void *sendbuf, const int sendcounts[], const int displs[
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_ISCATTERV);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ISCATTERV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -339,7 +339,7 @@ int MPI_Iscatterv(const void *sendbuf, const int sendcounts[], const int displs[
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ISCATTERV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/op_commutative.c b/src/mpi/coll/op_commutative.c
index 6367619..f6542de 100644
--- a/src/mpi/coll/op_commutative.c
+++ b/src/mpi/coll/op_commutative.c
@@ -60,7 +60,7 @@ int MPI_Op_commutative(MPI_Op op, int *commute)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_OP_COMMUTATIVE);
 
     MPID_Op_get_ptr( op, op_ptr );
@@ -92,7 +92,7 @@ int MPI_Op_commutative(MPI_Op op, int *commute)
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_OP_COMMUTATIVE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 fn_fail:
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/coll/op_create.c b/src/mpi/coll/op_create.c
index cfb88e1..adcbaee 100644
--- a/src/mpi/coll/op_create.c
+++ b/src/mpi/coll/op_create.c
@@ -108,7 +108,7 @@ int MPI_Op_create(MPI_User_function *user_fn, int commute, MPI_Op *op)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_OP_CREATE);
 
     /* ... body of routine ...  */
@@ -134,7 +134,7 @@ int MPI_Op_create(MPI_User_function *user_fn, int commute, MPI_Op *op)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_OP_CREATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/coll/op_free.c b/src/mpi/coll/op_free.c
index 9a28f5e..9dff0e8 100644
--- a/src/mpi/coll/op_free.c
+++ b/src/mpi/coll/op_free.c
@@ -64,7 +64,7 @@ int MPI_Op_free(MPI_Op *op)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_OP_FREE);
     
     MPID_Op_get_ptr( *op, op_ptr );
@@ -100,7 +100,7 @@ int MPI_Op_free(MPI_Op *op)
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_OP_FREE);
-        MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+        MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 	return mpi_errno;
 	
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/coll/red_scat.c b/src/mpi/coll/red_scat.c
index 7d494fb..9406325 100644
--- a/src/mpi/coll/red_scat.c
+++ b/src/mpi/coll/red_scat.c
@@ -1125,7 +1125,7 @@ int MPI_Reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_REDUCE_SCATTER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -1206,7 +1206,7 @@ int MPI_Reduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts[
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_REDUCE_SCATTER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/red_scat_block.c b/src/mpi/coll/red_scat_block.c
index 486a392..f342e98 100644
--- a/src/mpi/coll/red_scat_block.c
+++ b/src/mpi/coll/red_scat_block.c
@@ -1097,7 +1097,7 @@ int MPI_Reduce_scatter_block(const void *sendbuf, void *recvbuf,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_REDUCE_SCATTER_BLOCK);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -1172,7 +1172,7 @@ int MPI_Reduce_scatter_block(const void *sendbuf, void *recvbuf,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_REDUCE_SCATTER_BLOCK);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/reduce.c b/src/mpi/coll/reduce.c
index 7817e00..f68e317 100644
--- a/src/mpi/coll/reduce.c
+++ b/src/mpi/coll/reduce.c
@@ -1132,7 +1132,7 @@ int MPI_Reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_REDUCE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -1247,7 +1247,7 @@ int MPI_Reduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_REDUCE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/reduce_local.c b/src/mpi/coll/reduce_local.c
index df008ce..f232dd7 100644
--- a/src/mpi/coll/reduce_local.c
+++ b/src/mpi/coll/reduce_local.c
@@ -151,7 +151,7 @@ int MPI_Reduce_local(const void *inbuf, void *inoutbuf, int count, MPI_Datatype
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_REDUCE_LOCAL);
 
     /* Validate parameters */
@@ -190,7 +190,7 @@ int MPI_Reduce_local(const void *inbuf, void *inoutbuf, int count, MPI_Datatype
 
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_REDUCE_LOCAL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/scan.c b/src/mpi/coll/scan.c
index ee8ba5f..2e50c75 100644
--- a/src/mpi/coll/scan.c
+++ b/src/mpi/coll/scan.c
@@ -494,7 +494,7 @@ int MPI_Scan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_SCAN);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -566,7 +566,7 @@ int MPI_Scan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatyp
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_SCAN);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/scatter.c b/src/mpi/coll/scatter.c
index 4a852b4..992dfa2 100644
--- a/src/mpi/coll/scatter.c
+++ b/src/mpi/coll/scatter.c
@@ -678,7 +678,7 @@ int MPI_Scatter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_SCATTER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -793,7 +793,7 @@ int MPI_Scatter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_SCATTER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/scatterv.c b/src/mpi/coll/scatterv.c
index 3be0977..4adc33c 100644
--- a/src/mpi/coll/scatterv.c
+++ b/src/mpi/coll/scatterv.c
@@ -239,7 +239,7 @@ int MPI_Scatterv(const void *sendbuf, const int *sendcounts, const int *displs,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_SCATTERV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -375,7 +375,7 @@ int MPI_Scatterv(const void *sendbuf, const int *sendcounts, const int *displs,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_SCATTERV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/comm/comm_agree.c b/src/mpi/comm/comm_agree.c
index e3faf53..61eeeb8 100644
--- a/src/mpi/comm/comm_agree.c
+++ b/src/mpi/comm/comm_agree.c
@@ -136,7 +136,7 @@ int MPIX_Comm_agree(MPI_Comm comm, int *flag)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIX_COMM_AGREE);
 
     /* Validate parameters, and convert MPI object handles to object pointers */
@@ -172,7 +172,7 @@ int MPIX_Comm_agree(MPI_Comm comm, int *flag)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIX_COMM_AGREE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/comm/comm_compare.c b/src/mpi/comm/comm_compare.c
index 2990d31..11bf2fb 100644
--- a/src/mpi/comm/comm_compare.c
+++ b/src/mpi/comm/comm_compare.c
@@ -77,7 +77,7 @@ int MPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int *result)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_COMPARE);
 
 #   ifdef HAVE_ERROR_CHECKING
@@ -180,7 +180,7 @@ int MPI_Comm_compare(MPI_Comm comm1, MPI_Comm comm2, int *result)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_COMPARE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/comm/comm_create.c b/src/mpi/comm/comm_create.c
index 92f0c3e..a5c31ac 100644
--- a/src/mpi/comm/comm_create.c
+++ b/src/mpi/comm/comm_create.c
@@ -491,7 +491,7 @@ int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_CREATE);
 
     /* Validate parameters, and convert MPI object handles to object pointers */
@@ -553,7 +553,7 @@ int MPI_Comm_create(MPI_Comm comm, MPI_Group group, MPI_Comm *newcomm)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_CREATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/comm/comm_create_group.c b/src/mpi/comm/comm_create_group.c
index 262b435..a2923ff 100644
--- a/src/mpi/comm/comm_create_group.c
+++ b/src/mpi/comm/comm_create_group.c
@@ -158,7 +158,7 @@ int MPI_Comm_create_group(MPI_Comm comm, MPI_Group group, int tag, MPI_Comm * ne
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_CREATE_GROUP);
 
     /* Validate parameters, and convert MPI object handles to object pointers */
@@ -216,7 +216,7 @@ int MPI_Comm_create_group(MPI_Comm comm, MPI_Group group, int tag, MPI_Comm * ne
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_CREATE_GROUP);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/comm/comm_dup.c b/src/mpi/comm/comm_dup.c
index 34dd170..3d5285f 100644
--- a/src/mpi/comm/comm_dup.c
+++ b/src/mpi/comm/comm_dup.c
@@ -124,7 +124,7 @@ int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_DUP);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -166,7 +166,7 @@ int MPI_Comm_dup(MPI_Comm comm, MPI_Comm *newcomm)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_DUP);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/comm/comm_dup_with_info.c b/src/mpi/comm/comm_dup_with_info.c
index 5e20710..acd1ac1 100644
--- a/src/mpi/comm/comm_dup_with_info.c
+++ b/src/mpi/comm/comm_dup_with_info.c
@@ -94,7 +94,7 @@ int MPI_Comm_dup_with_info(MPI_Comm comm, MPI_Info info, MPI_Comm * newcomm)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_DUP_WITH_INFO);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -137,7 +137,7 @@ int MPI_Comm_dup_with_info(MPI_Comm comm, MPI_Info info, MPI_Comm * newcomm)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_DUP_WITH_INFO);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/comm/comm_failure_ack.c b/src/mpi/comm/comm_failure_ack.c
index 8ec8718..3f03313 100644
--- a/src/mpi/comm/comm_failure_ack.c
+++ b/src/mpi/comm/comm_failure_ack.c
@@ -58,7 +58,7 @@ int MPIX_Comm_failure_ack( MPI_Comm comm )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIX_COMM_FAILURE_ACK);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -98,7 +98,7 @@ int MPIX_Comm_failure_ack( MPI_Comm comm )
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIX_COMM_FAILURE_ACK);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/comm/comm_failure_get_acked.c b/src/mpi/comm/comm_failure_get_acked.c
index 82df0ca..74a6bb8 100644
--- a/src/mpi/comm/comm_failure_get_acked.c
+++ b/src/mpi/comm/comm_failure_get_acked.c
@@ -62,7 +62,7 @@ int MPIX_Comm_failure_get_acked( MPI_Comm comm, MPI_Group *failedgrp )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIX_COMM_FAILURE_GET_ACKED);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -102,7 +102,7 @@ int MPIX_Comm_failure_get_acked( MPI_Comm comm, MPI_Group *failedgrp )
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIX_COMM_FAILURE_GET_ACKED);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/comm/comm_free.c b/src/mpi/comm/comm_free.c
index 9f1ab29..3c2f8bb 100644
--- a/src/mpi/comm/comm_free.c
+++ b/src/mpi/comm/comm_free.c
@@ -82,7 +82,7 @@ int MPI_Comm_free(MPI_Comm *comm)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_FREE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -132,7 +132,7 @@ int MPI_Comm_free(MPI_Comm *comm)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_FREE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/comm/comm_get_info.c b/src/mpi/comm/comm_get_info.c
index c463606..4408112 100644
--- a/src/mpi/comm/comm_get_info.c
+++ b/src/mpi/comm/comm_get_info.c
@@ -84,7 +84,7 @@ int MPI_Comm_get_info(MPI_Comm comm, MPI_Info * info_used)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_GET_INFO);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -126,7 +126,7 @@ int MPI_Comm_get_info(MPI_Comm comm, MPI_Info * info_used)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_GET_INFO);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/comm/comm_group.c b/src/mpi/comm/comm_group.c
index 34bd903..16b0748 100644
--- a/src/mpi/comm/comm_group.c
+++ b/src/mpi/comm/comm_group.c
@@ -115,7 +115,7 @@ int MPI_Comm_group(MPI_Comm comm, MPI_Group *group)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_GROUP);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -156,7 +156,7 @@ int MPI_Comm_group(MPI_Comm comm, MPI_Group *group)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_GROUP);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/comm/comm_idup.c b/src/mpi/comm/comm_idup.c
index 6014962..c59893c 100644
--- a/src/mpi/comm/comm_idup.c
+++ b/src/mpi/comm/comm_idup.c
@@ -100,7 +100,7 @@ int MPI_Comm_idup(MPI_Comm comm, MPI_Comm *newcomm, MPI_Request *request)
     MPID_Request *dreq = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_IDUP);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_IDUP);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -150,7 +150,7 @@ int MPI_Comm_idup(MPI_Comm comm, MPI_Comm *newcomm, MPI_Request *request)
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_IDUP);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/comm/comm_rank.c b/src/mpi/comm/comm_rank.c
index aaf0e83..9960e87 100644
--- a/src/mpi/comm/comm_rank.c
+++ b/src/mpi/comm/comm_rank.c
@@ -57,7 +57,7 @@ int MPI_Comm_rank( MPI_Comm comm, int *rank )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_RANK);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -99,7 +99,7 @@ int MPI_Comm_rank( MPI_Comm comm, int *rank )
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_RANK);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/comm/comm_remote_group.c b/src/mpi/comm/comm_remote_group.c
index 3ff3a99..a655662 100644
--- a/src/mpi/comm/comm_remote_group.c
+++ b/src/mpi/comm/comm_remote_group.c
@@ -105,7 +105,7 @@ int MPI_Comm_remote_group(MPI_Comm comm, MPI_Group *group)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_REMOTE_GROUP);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -152,7 +152,7 @@ int MPI_Comm_remote_group(MPI_Comm comm, MPI_Group *group)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_REMOTE_GROUP);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/comm/comm_revoke.c b/src/mpi/comm/comm_revoke.c
index 0a2e629..d29414d 100644
--- a/src/mpi/comm/comm_revoke.c
+++ b/src/mpi/comm/comm_revoke.c
@@ -58,7 +58,7 @@ int MPIX_Comm_revoke(MPI_Comm comm)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIX_COMM_REVOKE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -97,7 +97,7 @@ int MPIX_Comm_revoke(MPI_Comm comm)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIX_COMM_REVOKE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
   fn_fail:
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/comm/comm_set_info.c b/src/mpi/comm/comm_set_info.c
index ff5c506..fed8349 100644
--- a/src/mpi/comm/comm_set_info.c
+++ b/src/mpi/comm/comm_set_info.c
@@ -104,7 +104,7 @@ int MPI_Comm_set_info(MPI_Comm comm, MPI_Info info)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_SET_INFO);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -143,7 +143,7 @@ int MPI_Comm_set_info(MPI_Comm comm, MPI_Info info)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_SET_INFO);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/comm/comm_shrink.c b/src/mpi/comm/comm_shrink.c
index dbbe3e4..21f11aa 100644
--- a/src/mpi/comm/comm_shrink.c
+++ b/src/mpi/comm/comm_shrink.c
@@ -140,7 +140,7 @@ int MPIX_Comm_shrink(MPI_Comm comm, MPI_Comm *newcomm)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIX_COMM_SHRINK);
 
     /* Validate parameters, and convert MPI object handles to object pointers */
@@ -180,7 +180,7 @@ int MPIX_Comm_shrink(MPI_Comm comm, MPI_Comm *newcomm)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIX_COMM_SHRINK);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/comm/comm_split.c b/src/mpi/comm/comm_split.c
index c606eeb..20f8294 100644
--- a/src/mpi/comm/comm_split.c
+++ b/src/mpi/comm/comm_split.c
@@ -441,7 +441,7 @@ int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_SPLIT);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -486,7 +486,7 @@ int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_SPLIT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/comm/comm_split_type.c b/src/mpi/comm/comm_split_type.c
index f358792..3d6f2a5 100644
--- a/src/mpi/comm/comm_split_type.c
+++ b/src/mpi/comm/comm_split_type.c
@@ -102,7 +102,7 @@ int MPI_Comm_split_type(MPI_Comm comm, int split_type, int key, MPI_Info info,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_SPLIT_TYPE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -150,7 +150,7 @@ int MPI_Comm_split_type(MPI_Comm comm, int split_type, int key, MPI_Info info,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_SPLIT_TYPE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/comm/contextid.c b/src/mpi/comm/contextid.c
index a60e184..87d10fd 100644
--- a/src/mpi/comm/contextid.c
+++ b/src/mpi/comm/contextid.c
@@ -349,7 +349,7 @@ int MPIR_Get_contextid_sparse_group(MPID_Comm * comm_ptr, MPID_Group * group_ptr
     while (*context_id == 0) {
         /* We lock only around access to the mask (except in the global locking
          * case).  If another thread is using the mask, we take a mask of zero. */
-        MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.ctx_mutex);
+        MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_CTX_MUTEX);
 
         if (initialize_context_mask) {
             context_id_init();
@@ -424,7 +424,7 @@ int MPIR_Get_contextid_sparse_group(MPID_Comm * comm_ptr, MPID_Group * group_ptr
                 MPIU_DBG_MSG(COMM, VERBOSE, "Copied local_mask");
             }
         }
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.ctx_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_CTX_MUTEX);
 
         /* Note: MPIR_MAX_CONTEXT_MASK elements of local_mask are used by the
          * context ID allocation algorithm.  The additional element is ignored
@@ -457,7 +457,7 @@ int MPIR_Get_contextid_sparse_group(MPID_Comm * comm_ptr, MPID_Group * group_ptr
 
         /* MT FIXME 2/3 cases don't seem to need the CONTEXTID CS, check and
          * narrow this region */
-        MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.ctx_mutex);
+        MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_CTX_MUTEX);
         if (ignore_id) {
             /* we don't care what the value was, but make sure that everyone
              * who did care agreed on a value */
@@ -481,8 +481,8 @@ int MPIR_Get_contextid_sparse_group(MPID_Comm * comm_ptr, MPID_Group * group_ptr
                 /* FIXME: Do we need to do an GLOBAL yield here?
                  * When we do a collective operation, we anyway yield
                  * for other others */
-                MPID_THREAD_CS_YIELD(GLOBAL, MPIR_ThreadInfo.global_mutex);
-                MPID_THREAD_CS_YIELD(POBJ, MPIR_ThreadInfo.ctx_mutex);
+                MPID_THREAD_CS_YIELD(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
+                MPID_THREAD_CS_YIELD(POBJ, MPIR_THREAD_CTX_MUTEX);
             }
         }
         else if (own_mask) {
@@ -511,8 +511,8 @@ int MPIR_Get_contextid_sparse_group(MPID_Comm * comm_ptr, MPID_Group * group_ptr
                 /* FIXME: Do we need to do an GLOBAL yield here?
                  * When we do a collective operation, we anyway yield
                  * for other others */
-                MPID_THREAD_CS_YIELD(GLOBAL, MPIR_ThreadInfo.global_mutex);
-                MPID_THREAD_CS_YIELD(POBJ, MPIR_ThreadInfo.ctx_mutex);
+                MPID_THREAD_CS_YIELD(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
+                MPID_THREAD_CS_YIELD(POBJ, MPIR_THREAD_CTX_MUTEX);
             }
         }
         else {
@@ -520,10 +520,10 @@ int MPIR_Get_contextid_sparse_group(MPID_Comm * comm_ptr, MPID_Group * group_ptr
             /* FIXME: Do we need to do an GLOBAL yield here?  When we
              * do a collective operation, we anyway yield for other
              * others */
-            MPID_THREAD_CS_YIELD(GLOBAL, MPIR_ThreadInfo.global_mutex);
-            MPID_THREAD_CS_YIELD(POBJ, MPIR_ThreadInfo.ctx_mutex);
+            MPID_THREAD_CS_YIELD(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
+            MPID_THREAD_CS_YIELD(POBJ, MPIR_THREAD_CTX_MUTEX);
         }
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.ctx_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_CTX_MUTEX);
 
         /* Test for context ID exhaustion: All threads that will participate in
          * the new communicator owned the mask and could not allocate a context
@@ -537,13 +537,13 @@ int MPIR_Get_contextid_sparse_group(MPID_Comm * comm_ptr, MPID_Group * group_ptr
             int minfree;
 
             if (own_mask) {
-                MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.ctx_mutex);
+                MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_CTX_MUTEX);
                 mask_in_use = 0;
                 if (lowest_context_id == comm_ptr->context_id && lowest_tag == tag) {
                     lowest_context_id = MPIR_MAXID;
                     lowest_tag = -1;
                 }
-                MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.ctx_mutex);
+                MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_CTX_MUTEX);
             }
 
             context_mask_stats(&nfree, &ntotal);
@@ -1159,12 +1159,12 @@ void MPIR_Free_contextid(MPIU_Context_id_t context_id)
     }
     /* --END ERROR HANDLING-- */
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.ctx_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_CTX_MUTEX);
     /* MT: Note that this update must be done atomically in the multithreaedd
      * case.  In the "one, single lock" implementation, that lock is indeed
      * held when this operation is called. */
     context_mask[idx] |= (0x1 << bitpos);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.ctx_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_CTX_MUTEX);
 
     MPIU_DBG_MSG_FMT(COMM, VERBOSE,
                      (MPIU_DBG_FDEST,
diff --git a/src/mpi/comm/intercomm_create.c b/src/mpi/comm/intercomm_create.c
index f5103fa..362d421 100644
--- a/src/mpi/comm/intercomm_create.c
+++ b/src/mpi/comm/intercomm_create.c
@@ -427,7 +427,7 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INTERCOMM_CREATE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -525,7 +525,7 @@ int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader,
     
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INTERCOMM_CREATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/comm/intercomm_merge.c b/src/mpi/comm/intercomm_merge.c
index 13aaca9..55efe38 100644
--- a/src/mpi/comm/intercomm_merge.c
+++ b/src/mpi/comm/intercomm_merge.c
@@ -260,7 +260,7 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high, MPI_Comm *newintracomm)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);  
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);  
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INTERCOMM_MERGE);
 
     MPIU_THREADPRIV_GET;
@@ -343,7 +343,7 @@ int MPI_Intercomm_merge(MPI_Comm intercomm, int high, MPI_Comm *newintracomm)
     
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INTERCOMM_MERGE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/get_elements_x.c b/src/mpi/datatype/get_elements_x.c
index 5ec9a8a..c779da6 100644
--- a/src/mpi/datatype/get_elements_x.c
+++ b/src/mpi/datatype/get_elements_x.c
@@ -386,7 +386,7 @@ int MPI_Get_elements_x(const MPI_Status *status, MPI_Datatype datatype, MPI_Coun
     int mpi_errno = MPI_SUCCESS;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_GET_ELEMENTS_X);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GET_ELEMENTS_X);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -433,7 +433,7 @@ int MPI_Get_elements_x(const MPI_Status *status, MPI_Datatype datatype, MPI_Coun
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GET_ELEMENTS_X);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/datatype/register_datarep.c b/src/mpi/datatype/register_datarep.c
index 43b321a..c5124a1 100644
--- a/src/mpi/datatype/register_datarep.c
+++ b/src/mpi/datatype/register_datarep.c
@@ -60,7 +60,7 @@ int MPI_Register_datarep(char *datarep,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_REGISTER_DATAREP);
     
     /* Validate parameters and objects (post conversion) */
@@ -85,7 +85,7 @@ int MPI_Register_datarep(char *datarep,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_REGISTER_DATAREP);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/status_set_elements_x.c b/src/mpi/datatype/status_set_elements_x.c
index 4e7c78f..dc81bdd 100644
--- a/src/mpi/datatype/status_set_elements_x.c
+++ b/src/mpi/datatype/status_set_elements_x.c
@@ -78,7 +78,7 @@ int MPI_Status_set_elements_x(MPI_Status *status, MPI_Datatype datatype, MPI_Cou
     int mpi_errno = MPI_SUCCESS;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_STATUS_SET_ELEMENTS_X);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_STATUS_SET_ELEMENTS_X);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -125,7 +125,7 @@ int MPI_Status_set_elements_x(MPI_Status *status, MPI_Datatype datatype, MPI_Cou
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_STATUS_SET_ELEMENTS_X);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/datatype/type_commit.c b/src/mpi/datatype/type_commit.c
index 895d669..10b4c5a 100644
--- a/src/mpi/datatype/type_commit.c
+++ b/src/mpi/datatype/type_commit.c
@@ -78,7 +78,7 @@ int MPI_Type_commit(MPI_Datatype *datatype)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_COMMIT);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -120,7 +120,7 @@ int MPI_Type_commit(MPI_Datatype *datatype)
     
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_COMMIT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_contiguous.c b/src/mpi/datatype/type_contiguous.c
index aa974f9..81fc72b 100644
--- a/src/mpi/datatype/type_contiguous.c
+++ b/src/mpi/datatype/type_contiguous.c
@@ -146,7 +146,7 @@ int MPI_Type_contiguous(int count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CONTIGUOUS);
 
 #   ifdef HAVE_ERROR_CHECKING
@@ -177,7 +177,7 @@ int MPI_Type_contiguous(int count,
     
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CONTIGUOUS);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_create_darray.c b/src/mpi/datatype/type_create_darray.c
index 005b6ec..87b1ef4 100644
--- a/src/mpi/datatype/type_create_darray.c
+++ b/src/mpi/datatype/type_create_darray.c
@@ -392,7 +392,7 @@ int MPI_Type_create_darray(int size,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_DARRAY);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -745,7 +745,7 @@ int MPI_Type_create_darray(int size,
   fn_exit:
     MPIU_CHKLMEM_FREEALL();
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_DARRAY);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_create_hindexed.c b/src/mpi/datatype/type_create_hindexed.c
index 7a79f7f..c0c9ed1 100644
--- a/src/mpi/datatype/type_create_hindexed.c
+++ b/src/mpi/datatype/type_create_hindexed.c
@@ -71,7 +71,7 @@ int MPI_Type_create_hindexed(int count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_HINDEXED);
 
 #   ifdef HAVE_ERROR_CHECKING
@@ -139,7 +139,7 @@ int MPI_Type_create_hindexed(int count,
   fn_exit:
     MPIU_CHKLMEM_FREEALL();
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_HINDEXED);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_create_hindexed_block.c b/src/mpi/datatype/type_create_hindexed_block.c
index 15bf367..ad4ac1e 100644
--- a/src/mpi/datatype/type_create_hindexed_block.c
+++ b/src/mpi/datatype/type_create_hindexed_block.c
@@ -106,7 +106,7 @@ int MPI_Type_create_hindexed_block(int count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_HINDEXED_BLOCK);
 
     /* Validate parameters and objects */
@@ -147,7 +147,7 @@ int MPI_Type_create_hindexed_block(int count,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_HINDEXED_BLOCK);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_create_hvector.c b/src/mpi/datatype/type_create_hvector.c
index 830e9e7..21f33e2 100644
--- a/src/mpi/datatype/type_create_hvector.c
+++ b/src/mpi/datatype/type_create_hvector.c
@@ -68,7 +68,7 @@ int MPI_Type_create_hvector(int count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_HVECTOR);
 
 #   ifdef HAVE_ERROR_CHECKING
@@ -121,7 +121,7 @@ int MPI_Type_create_hvector(int count,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_HVECTOR);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_create_indexed_block.c b/src/mpi/datatype/type_create_indexed_block.c
index 97a8d66..6946344 100644
--- a/src/mpi/datatype/type_create_indexed_block.c
+++ b/src/mpi/datatype/type_create_indexed_block.c
@@ -140,7 +140,7 @@ int MPI_Type_create_indexed_block(int count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_INDEXED_BLOCK);
     
     /* Validate parameters and objects */
@@ -180,7 +180,7 @@ int MPI_Type_create_indexed_block(int count,
     
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_INDEXED_BLOCK);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_create_resized.c b/src/mpi/datatype/type_create_resized.c
index 7567dde..e4786f5 100644
--- a/src/mpi/datatype/type_create_resized.c
+++ b/src/mpi/datatype/type_create_resized.c
@@ -65,7 +65,7 @@ int MPI_Type_create_resized(MPI_Datatype oldtype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_RESIZED);
 
     /* Get handles to MPI objects. */
@@ -115,7 +115,7 @@ int MPI_Type_create_resized(MPI_Datatype oldtype,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_RESIZED);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_create_struct.c b/src/mpi/datatype/type_create_struct.c
index 2a979d5..acbcd11 100644
--- a/src/mpi/datatype/type_create_struct.c
+++ b/src/mpi/datatype/type_create_struct.c
@@ -119,7 +119,7 @@ int MPI_Type_create_struct(int count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_STRUCT);
 
 #   ifdef HAVE_ERROR_CHECKING
@@ -162,7 +162,7 @@ int MPI_Type_create_struct(int count,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_STRUCT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_create_subarray.c b/src/mpi/datatype/type_create_subarray.c
index bcdba9c..c8648e8 100644
--- a/src/mpi/datatype/type_create_subarray.c
+++ b/src/mpi/datatype/type_create_subarray.c
@@ -88,7 +88,7 @@ int MPI_Type_create_subarray(int ndims,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_SUBARRAY);
 
 #   ifdef HAVE_ERROR_CHECKING
@@ -333,7 +333,7 @@ int MPI_Type_create_subarray(int ndims,
   fn_exit:
     MPIU_CHKLMEM_FREEALL();
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_SUBARRAY);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_dup.c b/src/mpi/datatype/type_dup.c
index 3965991..5b53f7b 100644
--- a/src/mpi/datatype/type_dup.c
+++ b/src/mpi/datatype/type_dup.c
@@ -58,7 +58,7 @@ int MPI_Type_dup(MPI_Datatype oldtype, MPI_Datatype *newtype)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_DUP);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -134,7 +134,7 @@ int MPI_Type_dup(MPI_Datatype oldtype, MPI_Datatype *newtype)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_DUP);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_free.c b/src/mpi/datatype/type_free.c
index a6ae104..0f6e086 100644
--- a/src/mpi/datatype/type_free.c
+++ b/src/mpi/datatype/type_free.c
@@ -77,7 +77,7 @@ int MPI_Type_free(MPI_Datatype *datatype)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_FREE);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -146,7 +146,7 @@ int MPI_Type_free(MPI_Datatype *datatype)
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_FREE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/datatype/type_get_contents.c b/src/mpi/datatype/type_get_contents.c
index 1222be3..bc4a2c7 100644
--- a/src/mpi/datatype/type_get_contents.c
+++ b/src/mpi/datatype/type_get_contents.c
@@ -67,7 +67,7 @@ int MPI_Type_get_contents(MPI_Datatype datatype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_GET_CONTENTS);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -142,7 +142,7 @@ int MPI_Type_get_contents(MPI_Datatype datatype,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_GET_CONTENTS);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_get_extent_x.c b/src/mpi/datatype/type_get_extent_x.c
index c98fdf7..62381b3 100644
--- a/src/mpi/datatype/type_get_extent_x.c
+++ b/src/mpi/datatype/type_get_extent_x.c
@@ -73,7 +73,7 @@ int MPI_Type_get_extent_x(MPI_Datatype datatype, MPI_Count *lb, MPI_Count *exten
     int mpi_errno = MPI_SUCCESS;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_TYPE_GET_EXTENT_X);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_GET_EXTENT_X);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -118,7 +118,7 @@ int MPI_Type_get_extent_x(MPI_Datatype datatype, MPI_Count *lb, MPI_Count *exten
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_GET_EXTENT_X);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/datatype/type_get_name.c b/src/mpi/datatype/type_get_name.c
index 1296916..123329c 100644
--- a/src/mpi/datatype/type_get_name.c
+++ b/src/mpi/datatype/type_get_name.c
@@ -146,7 +146,7 @@ int MPIR_Datatype_init_names(void)
     MPID_Datatype *datatype_ptr = NULL;
     static volatile int needsInit = 1;
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     if (needsInit) {
 	/* Make sure that the basics have datatype structures allocated
 	 * and filled in for them.  They are just integers prior to this
@@ -204,7 +204,7 @@ int MPIR_Datatype_init_names(void)
 
 fn_fail:
     /* empty statement */ ;
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 }
 #endif
diff --git a/src/mpi/datatype/type_get_true_extent_x.c b/src/mpi/datatype/type_get_true_extent_x.c
index 8ccfdf9..6f4453d 100644
--- a/src/mpi/datatype/type_get_true_extent_x.c
+++ b/src/mpi/datatype/type_get_true_extent_x.c
@@ -73,7 +73,7 @@ int MPI_Type_get_true_extent_x(MPI_Datatype datatype, MPI_Count *true_lb, MPI_Co
     int mpi_errno = MPI_SUCCESS;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_TYPE_GET_TRUE_EXTENT_X);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_GET_TRUE_EXTENT_X);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -118,7 +118,7 @@ int MPI_Type_get_true_extent_x(MPI_Datatype datatype, MPI_Count *true_lb, MPI_Co
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_GET_TRUE_EXTENT_X);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/datatype/type_hindexed.c b/src/mpi/datatype/type_hindexed.c
index 35dbd73..1486504 100644
--- a/src/mpi/datatype/type_hindexed.c
+++ b/src/mpi/datatype/type_hindexed.c
@@ -96,7 +96,7 @@ int MPI_Type_hindexed(int count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_HINDEXED);
 
 #   ifdef HAVE_ERROR_CHECKING
@@ -165,7 +165,7 @@ int MPI_Type_hindexed(int count,
   fn_exit:
     MPIU_CHKLMEM_FREEALL();
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_HINDEXED);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_hvector.c b/src/mpi/datatype/type_hvector.c
index d303264..50a5ed5 100644
--- a/src/mpi/datatype/type_hvector.c
+++ b/src/mpi/datatype/type_hvector.c
@@ -104,7 +104,7 @@ int MPI_Type_hvector(int count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_HVECTOR);
 
 #   ifdef HAVE_ERROR_CHECKING
@@ -138,7 +138,7 @@ int MPI_Type_hvector(int count,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_HVECTOR);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_indexed.c b/src/mpi/datatype/type_indexed.c
index 199d6f5..0cbd90e 100644
--- a/src/mpi/datatype/type_indexed.c
+++ b/src/mpi/datatype/type_indexed.c
@@ -145,7 +145,7 @@ int MPI_Type_indexed(int count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_INDEXED);
 
     /* Validate parameters and objects (post conversion) */
@@ -187,7 +187,7 @@ int MPI_Type_indexed(int count,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_INDEXED);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_match_size.c b/src/mpi/datatype/type_match_size.c
index ca2e377..bc5f71d 100644
--- a/src/mpi/datatype/type_match_size.c
+++ b/src/mpi/datatype/type_match_size.c
@@ -89,7 +89,7 @@ int MPI_Type_match_size(int typeclass, int size, MPI_Datatype *datatype)
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
     /* FIXME: This routine does not require the global critical section */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_MATCH_SIZE);
 
     MPIU_THREADPRIV_GET;
@@ -187,7 +187,7 @@ int MPI_Type_match_size(int typeclass, int size, MPI_Datatype *datatype)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_MATCH_SIZE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_size_x.c b/src/mpi/datatype/type_size_x.c
index 759fe8d..626b44f 100644
--- a/src/mpi/datatype/type_size_x.c
+++ b/src/mpi/datatype/type_size_x.c
@@ -69,7 +69,7 @@ int MPI_Type_size_x(MPI_Datatype datatype, MPI_Count *size)
     int mpi_errno = MPI_SUCCESS;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_TYPE_SIZE_X);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_SIZE_X);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -115,7 +115,7 @@ int MPI_Type_size_x(MPI_Datatype datatype, MPI_Count *size)
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_SIZE_X);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/datatype/type_struct.c b/src/mpi/datatype/type_struct.c
index 6a3abcf..c1d8e4f 100644
--- a/src/mpi/datatype/type_struct.c
+++ b/src/mpi/datatype/type_struct.c
@@ -159,7 +159,7 @@ int MPI_Type_struct(int count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_STRUCT);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -202,7 +202,7 @@ int MPI_Type_struct(int count,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_STRUCT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/datatype/type_vector.c b/src/mpi/datatype/type_vector.c
index 13a57b2..4beb5ae 100644
--- a/src/mpi/datatype/type_vector.c
+++ b/src/mpi/datatype/type_vector.c
@@ -107,7 +107,7 @@ int MPI_Type_vector(int count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_VECTOR);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -140,7 +140,7 @@ int MPI_Type_vector(int count,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_VECTOR);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/errhan/add_error_class.c b/src/mpi/errhan/add_error_class.c
index c35a7bb..b4382c2 100644
--- a/src/mpi/errhan/add_error_class.c
+++ b/src/mpi/errhan/add_error_class.c
@@ -54,7 +54,7 @@ int MPI_Add_error_class(int *errorclass)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ADD_ERROR_CLASS);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -84,7 +84,7 @@ int MPI_Add_error_class(int *errorclass)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ADD_ERROR_CLASS);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/errhan/add_error_code.c b/src/mpi/errhan/add_error_code.c
index 3fc704d..08f114e 100644
--- a/src/mpi/errhan/add_error_code.c
+++ b/src/mpi/errhan/add_error_code.c
@@ -57,7 +57,7 @@ int MPI_Add_error_code(int errorclass, int *errorcode)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ADD_ERROR_CODE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -83,7 +83,7 @@ int MPI_Add_error_code(int errorclass, int *errorcode)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ADD_ERROR_CODE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/errhan/add_error_string.c b/src/mpi/errhan/add_error_string.c
index 8c79a9e..d814bad 100644
--- a/src/mpi/errhan/add_error_string.c
+++ b/src/mpi/errhan/add_error_string.c
@@ -66,7 +66,7 @@ int MPI_Add_error_string(int errorcode, const char *string)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ADD_ERROR_STRING);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -89,7 +89,7 @@ int MPI_Add_error_string(int errorcode, const char *string)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ADD_ERROR_STRING);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/errhan/comm_create_errhandler.c b/src/mpi/errhan/comm_create_errhandler.c
index d9031c9..e736a55 100644
--- a/src/mpi/errhan/comm_create_errhandler.c
+++ b/src/mpi/errhan/comm_create_errhandler.c
@@ -89,7 +89,7 @@ int MPI_Comm_create_errhandler(MPI_Comm_errhandler_function *comm_errhandler_fn,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_CREATE_ERRHANDLER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -113,7 +113,7 @@ int MPI_Comm_create_errhandler(MPI_Comm_errhandler_function *comm_errhandler_fn,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_CREATE_ERRHANDLER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/errhan/comm_get_errhandler.c b/src/mpi/errhan/comm_get_errhandler.c
index c39d3ff..6cdad86 100644
--- a/src/mpi/errhan/comm_get_errhandler.c
+++ b/src/mpi/errhan/comm_get_errhandler.c
@@ -74,7 +74,7 @@ int MPI_Comm_get_errhandler(MPI_Comm comm, MPI_Errhandler *errhandler)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_GET_ERRHANDLER);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -119,7 +119,7 @@ int MPI_Comm_get_errhandler(MPI_Comm comm, MPI_Errhandler *errhandler)
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_GET_ERRHANDLER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/errhan/comm_set_errhandler.c b/src/mpi/errhan/comm_set_errhandler.c
index 524a345..e2f74f2 100644
--- a/src/mpi/errhan/comm_set_errhandler.c
+++ b/src/mpi/errhan/comm_set_errhandler.c
@@ -86,7 +86,7 @@ int MPI_Comm_set_errhandler(MPI_Comm comm, MPI_Errhandler errhandler)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_SET_ERRHANDLER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -131,7 +131,7 @@ int MPI_Comm_set_errhandler(MPI_Comm comm, MPI_Errhandler errhandler)
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_SET_ERRHANDLER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/errhan/errhandler_create.c b/src/mpi/errhan/errhandler_create.c
index fdbb4bb..ce055a7 100644
--- a/src/mpi/errhan/errhandler_create.c
+++ b/src/mpi/errhan/errhandler_create.c
@@ -69,7 +69,7 @@ int MPI_Errhandler_create(MPI_Handler_function *function,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ERRHANDLER_CREATE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -92,7 +92,7 @@ int MPI_Errhandler_create(MPI_Handler_function *function,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ERRHANDLER_CREATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/errhan/errhandler_free.c b/src/mpi/errhan/errhandler_free.c
index 6ce0e26..ec3c6b3 100644
--- a/src/mpi/errhan/errhandler_free.c
+++ b/src/mpi/errhan/errhandler_free.c
@@ -57,7 +57,7 @@ int MPI_Errhandler_free(MPI_Errhandler *errhandler)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ERRHANDLER_FREE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -101,7 +101,7 @@ int MPI_Errhandler_free(MPI_Errhandler *errhandler)
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ERRHANDLER_FREE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/errhan/errhandler_get.c b/src/mpi/errhan/errhandler_get.c
index b1ce71d..7e9f586 100644
--- a/src/mpi/errhan/errhandler_get.c
+++ b/src/mpi/errhan/errhandler_get.c
@@ -70,7 +70,7 @@ int MPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ERRHANDLER_GET);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -115,7 +115,7 @@ int MPI_Errhandler_get(MPI_Comm comm, MPI_Errhandler *errhandler)
   fn_exit:
 #   endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ERRHANDLER_GET);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 #   ifdef HAVE_ERROR_CHECKING
diff --git a/src/mpi/errhan/errhandler_set.c b/src/mpi/errhan/errhandler_set.c
index 5f19a23..797afb5 100644
--- a/src/mpi/errhan/errhandler_set.c
+++ b/src/mpi/errhan/errhandler_set.c
@@ -61,7 +61,7 @@ int MPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ERRHANDLER_SET);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -108,7 +108,7 @@ int MPI_Errhandler_set(MPI_Comm comm, MPI_Errhandler errhandler)
   fn_exit:
 #   endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ERRHANDLER_SET);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 #   ifdef HAVE_ERROR_CHECKING
diff --git a/src/mpi/errhan/file_create_errhandler.c b/src/mpi/errhan/file_create_errhandler.c
index 251a815..31dd6c1 100644
--- a/src/mpi/errhan/file_create_errhandler.c
+++ b/src/mpi/errhan/file_create_errhandler.c
@@ -57,7 +57,7 @@ int MPI_File_create_errhandler(MPI_File_errhandler_function *file_errhandler_fn,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_FILE_CREATE_ERRHANDLER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -86,7 +86,7 @@ int MPI_File_create_errhandler(MPI_File_errhandler_function *file_errhandler_fn,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_FILE_CREATE_ERRHANDLER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/errhan/file_get_errhandler.c b/src/mpi/errhan/file_get_errhandler.c
index 7816541..b13f97d 100644
--- a/src/mpi/errhan/file_get_errhandler.c
+++ b/src/mpi/errhan/file_get_errhandler.c
@@ -64,7 +64,7 @@ int MPI_File_get_errhandler(MPI_File file, MPI_Errhandler *errhandler)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_FILE_GET_ERRHANDLER);
 
 #ifdef MPI_MODE_RDONLY
@@ -107,7 +107,7 @@ int MPI_File_get_errhandler(MPI_File file, MPI_Errhandler *errhandler)
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_FILE_GET_ERRHANDLER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/errhan/win_create_errhandler.c b/src/mpi/errhan/win_create_errhandler.c
index 733e5d9..d4a1d91 100644
--- a/src/mpi/errhan/win_create_errhandler.c
+++ b/src/mpi/errhan/win_create_errhandler.c
@@ -59,7 +59,7 @@ int MPI_Win_create_errhandler(MPI_Win_errhandler_function *win_errhandler_fn,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_CREATE_ERRHANDLER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -89,7 +89,7 @@ int MPI_Win_create_errhandler(MPI_Win_errhandler_function *win_errhandler_fn,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_CREATE_ERRHANDLER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/errhan/win_get_errhandler.c b/src/mpi/errhan/win_get_errhandler.c
index 73d9aa5..6fd4887 100644
--- a/src/mpi/errhan/win_get_errhandler.c
+++ b/src/mpi/errhan/win_get_errhandler.c
@@ -59,7 +59,7 @@ int MPI_Win_get_errhandler(MPI_Win win, MPI_Errhandler *errhandler)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_GET_ERRHANDLER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -112,7 +112,7 @@ int MPI_Win_get_errhandler(MPI_Win win, MPI_Errhandler *errhandler)
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_GET_ERRHANDLER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/group/group_compare.c b/src/mpi/group/group_compare.c
index bf7c1e4..ae7b733 100644
--- a/src/mpi/group/group_compare.c
+++ b/src/mpi/group/group_compare.c
@@ -119,7 +119,7 @@ int MPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result)
     /* The routines that setup the group data structures must be executed
        within a mutex.  As most of the group routines are not performance
        critical, we simple run these routines within the SINGLE_CS */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GROUP_COMPARE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -163,7 +163,7 @@ int MPI_Group_compare(MPI_Group group1, MPI_Group group2, int *result)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GROUP_COMPARE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/group/group_difference.c b/src/mpi/group/group_difference.c
index 4ead944..4c18fd0 100644
--- a/src/mpi/group/group_difference.c
+++ b/src/mpi/group/group_difference.c
@@ -146,7 +146,7 @@ int MPI_Group_difference(MPI_Group group1, MPI_Group group2, MPI_Group *newgroup
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GROUP_DIFFERENCE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -191,7 +191,7 @@ int MPI_Group_difference(MPI_Group group1, MPI_Group group2, MPI_Group *newgroup
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GROUP_DIFFERENCE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/group/group_excl.c b/src/mpi/group/group_excl.c
index 8fffc31..701f45a 100644
--- a/src/mpi/group/group_excl.c
+++ b/src/mpi/group/group_excl.c
@@ -123,7 +123,7 @@ int MPI_Group_excl(MPI_Group group, int n, const int ranks[], MPI_Group *newgrou
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GROUP_EXCL);
     /* Validate parameters, especially handles needing to be converted */
 #   ifdef HAVE_ERROR_CHECKING
@@ -172,7 +172,7 @@ int MPI_Group_excl(MPI_Group group, int n, const int ranks[], MPI_Group *newgrou
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GROUP_EXCL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/group/group_free.c b/src/mpi/group/group_free.c
index c80dc36..2084bfd 100644
--- a/src/mpi/group/group_free.c
+++ b/src/mpi/group/group_free.c
@@ -78,7 +78,7 @@ int MPI_Group_free(MPI_Group *group)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GROUP_FREE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -128,7 +128,7 @@ int MPI_Group_free(MPI_Group *group)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GROUP_FREE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/group/group_incl.c b/src/mpi/group/group_incl.c
index 5a3f321..9e85e75 100644
--- a/src/mpi/group/group_incl.c
+++ b/src/mpi/group/group_incl.c
@@ -109,7 +109,7 @@ int MPI_Group_incl(MPI_Group group, int n, const int ranks[], MPI_Group *newgrou
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GROUP_INCL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -161,7 +161,7 @@ int MPI_Group_incl(MPI_Group group, int n, const int ranks[], MPI_Group *newgrou
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GROUP_INCL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/group/group_intersection.c b/src/mpi/group/group_intersection.c
index 1ff108a..a6a3d81 100644
--- a/src/mpi/group/group_intersection.c
+++ b/src/mpi/group/group_intersection.c
@@ -146,7 +146,7 @@ int MPI_Group_intersection(MPI_Group group1, MPI_Group group2, MPI_Group *newgro
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GROUP_INTERSECTION);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -191,7 +191,7 @@ int MPI_Group_intersection(MPI_Group group1, MPI_Group group2, MPI_Group *newgro
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GROUP_INTERSECTION);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/group/group_range_excl.c b/src/mpi/group/group_range_excl.c
index b050e7c..3ca5d23 100644
--- a/src/mpi/group/group_range_excl.c
+++ b/src/mpi/group/group_range_excl.c
@@ -159,7 +159,7 @@ int MPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GROUP_RANGE_EXCL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -208,7 +208,7 @@ int MPI_Group_range_excl(MPI_Group group, int n, int ranges[][3],
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GROUP_RANGE_EXCL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/group/group_range_incl.c b/src/mpi/group/group_range_incl.c
index 1b78dc1..d458739 100644
--- a/src/mpi/group/group_range_incl.c
+++ b/src/mpi/group/group_range_incl.c
@@ -138,7 +138,7 @@ int MPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GROUP_RANGE_INCL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -184,7 +184,7 @@ int MPI_Group_range_incl(MPI_Group group, int n, int ranges[][3],
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GROUP_RANGE_INCL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/group/group_translate_ranks.c b/src/mpi/group/group_translate_ranks.c
index 573ef28..07693d8 100644
--- a/src/mpi/group/group_translate_ranks.c
+++ b/src/mpi/group/group_translate_ranks.c
@@ -150,7 +150,7 @@ int MPI_Group_translate_ranks(MPI_Group group1, int n, const int ranks1[],
     /* The routines that setup the group data structures must be executed
        within a mutex.  As most of the group routines are not performance
        critical, we simple run these routines within the SINGLE_CS */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GROUP_TRANSLATE_RANKS);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -210,7 +210,7 @@ int MPI_Group_translate_ranks(MPI_Group group1, int n, const int ranks1[],
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GROUP_TRANSLATE_RANKS);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/group/group_union.c b/src/mpi/group/group_union.c
index a091413..65fd375 100644
--- a/src/mpi/group/group_union.c
+++ b/src/mpi/group/group_union.c
@@ -179,7 +179,7 @@ int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *newgroup)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex); 
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX); 
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GROUP_UNION);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -224,7 +224,7 @@ int MPI_Group_union(MPI_Group group1, MPI_Group group2, MPI_Group *newgroup)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GROUP_UNION);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/info/info_create.c b/src/mpi/info/info_create.c
index 33f1f65..7e14ee6 100644
--- a/src/mpi/info/info_create.c
+++ b/src/mpi/info/info_create.c
@@ -52,7 +52,7 @@ int MPI_Info_create( MPI_Info *info )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INFO_CREATE);
 
     /* Validate parameters and objects (post conversion) */
@@ -80,7 +80,7 @@ int MPI_Info_create( MPI_Info *info )
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INFO_CREATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/info/info_delete.c b/src/mpi/info/info_delete.c
index 84c088b..1ab1c17 100644
--- a/src/mpi/info/info_delete.c
+++ b/src/mpi/info/info_delete.c
@@ -52,7 +52,7 @@ int MPI_Info_delete( MPI_Info info, const char *key )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INFO_DELETE);
     
 
@@ -115,7 +115,7 @@ int MPI_Info_delete( MPI_Info info, const char *key )
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INFO_DELETE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/info/info_dup.c b/src/mpi/info/info_dup.c
index d31299b..165f0b2 100644
--- a/src/mpi/info/info_dup.c
+++ b/src/mpi/info/info_dup.c
@@ -99,7 +99,7 @@ int MPI_Info_dup( MPI_Info info, MPI_Info *newinfo )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INFO_DUP);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -140,7 +140,7 @@ int MPI_Info_dup( MPI_Info info, MPI_Info *newinfo )
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INFO_DUP);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/info/info_free.c b/src/mpi/info/info_free.c
index 0840005..ed684a3 100644
--- a/src/mpi/info/info_free.c
+++ b/src/mpi/info/info_free.c
@@ -55,7 +55,7 @@ int MPI_Info_free( MPI_Info *info )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INFO_FREE);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -96,7 +96,7 @@ int MPI_Info_free( MPI_Info *info )
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INFO_FREE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/info/info_get.c b/src/mpi/info/info_get.c
index 4508b79..8046715 100644
--- a/src/mpi/info/info_get.c
+++ b/src/mpi/info/info_get.c
@@ -99,7 +99,7 @@ int MPI_Info_get(MPI_Info info, const char *key, int valuelen, char *value,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INFO_GET);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -152,7 +152,7 @@ int MPI_Info_get(MPI_Info info, const char *key, int valuelen, char *value,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INFO_GET);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/info/info_getn.c b/src/mpi/info/info_getn.c
index 2725b60..9251264 100644
--- a/src/mpi/info/info_getn.c
+++ b/src/mpi/info/info_getn.c
@@ -77,7 +77,7 @@ int MPI_Info_get_nkeys( MPI_Info info, int *nkeys )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INFO_GET_NKEYS);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -119,7 +119,7 @@ int MPI_Info_get_nkeys( MPI_Info info, int *nkeys )
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INFO_GET_NKEYS);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/info/info_getnth.c b/src/mpi/info/info_getnth.c
index bb1b69d..4a2bd3d 100644
--- a/src/mpi/info/info_getnth.c
+++ b/src/mpi/info/info_getnth.c
@@ -88,7 +88,7 @@ int MPI_Info_get_nthkey( MPI_Info info, int n, char *key )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INFO_GET_NTHKEY);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -127,7 +127,7 @@ int MPI_Info_get_nthkey( MPI_Info info, int n, char *key )
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INFO_GET_NTHKEY);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/info/info_getvallen.c b/src/mpi/info/info_getvallen.c
index 09bc93f..696b411 100644
--- a/src/mpi/info/info_getvallen.c
+++ b/src/mpi/info/info_getvallen.c
@@ -83,7 +83,7 @@ int MPI_Info_get_valuelen( MPI_Info info, const char *key, int *valuelen, int *f
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INFO_GET_VALUELEN);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -136,7 +136,7 @@ int MPI_Info_get_valuelen( MPI_Info info, const char *key, int *valuelen, int *f
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INFO_GET_VALUELEN);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/info/info_set.c b/src/mpi/info/info_set.c
index 8550d3b..f3260cd 100644
--- a/src/mpi/info/info_set.c
+++ b/src/mpi/info/info_set.c
@@ -58,7 +58,7 @@ int MPI_Info_set( MPI_Info info, const char *key, const char *value )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex); 
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX); 
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INFO_SET);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -106,7 +106,7 @@ int MPI_Info_set( MPI_Info info, const char *key, const char *value )
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INFO_SET);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/init/abort.c b/src/mpi/init/abort.c
index fda7232..acf5b59 100644
--- a/src/mpi/init/abort.c
+++ b/src/mpi/init/abort.c
@@ -86,7 +86,7 @@ int MPI_Abort(MPI_Comm comm, int errorcode)
        since that could result in the Abort hanging if another routine is
        hung holding the critical section.  Also note the "not thread-safe"
        comment in the description of MPI_Abort above. */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ABORT);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -144,7 +144,7 @@ int MPI_Abort(MPI_Comm comm, int errorcode)
     
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ABORT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/init/async.c b/src/mpi/init/async.c
index ba64278..0294c6b 100644
--- a/src/mpi/init/async.c
+++ b/src/mpi/init/async.c
@@ -35,7 +35,7 @@ static void progress_fn(void * data)
     /* Explicitly add CS_ENTER/EXIT since this thread is created from
      * within an internal function and will call NMPI functions
      * directly. */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     /* FIXME: We assume that waiting on some request forces progress
      * on all requests. With fine-grained threads, will this still
@@ -65,7 +65,7 @@ static void progress_fn(void * data)
     MPIU_Thread_cond_signal(&progress_cond, &mpi_errno);
     MPIU_Assert(!mpi_errno);
 
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return;
 }
@@ -135,7 +135,7 @@ int MPIR_Finalize_async_thread(void)
     MPIU_Assert(!mpi_errno);
 
     /* XXX DJG why is this unlock/lock necessary?  Should we just YIELD here or later?  */
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     MPIU_Thread_mutex_lock(&progress_mutex, &mpi_errno);
     MPIU_Assert(!mpi_errno);
@@ -151,7 +151,7 @@ int MPIR_Finalize_async_thread(void)
     mpi_errno = MPIR_Comm_free_impl(progress_comm_ptr);
     MPIU_Assert(!mpi_errno);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     MPIU_Thread_cond_destroy(&progress_cond, &mpi_errno);
     MPIU_Assert(!mpi_errno);
diff --git a/src/mpi/init/finalize.c b/src/mpi/init/finalize.c
index c617a7a..534090e 100644
--- a/src/mpi/init/finalize.c
+++ b/src/mpi/init/finalize.c
@@ -151,7 +151,7 @@ int MPI_Finalize( void )
 
     /* Note: Only one thread may ever call MPI_Finalize (MPI_Finalize may
        be called at most once in any program) */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FINALIZE_FUNC_ENTER(MPID_STATE_MPI_FINALIZE);
     
     /* ... body of routine ... */
@@ -257,7 +257,7 @@ int MPI_Finalize( void )
     /* If memory debugging is enabled, check the memory here, after all
        finalize callbacks */
 
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     OPA_store_int(&MPIR_Process.mpich_state, MPICH_POST_FINALIZED);
 
 #if defined(MPICH_IS_THREADED)
@@ -319,7 +319,7 @@ int MPI_Finalize( void )
 #   endif
     mpi_errno = MPIR_Err_return_comm( 0, FCNAME, mpi_errno );
     if (OPA_load_int(&MPIR_Process.mpich_state) < MPICH_POST_FINALIZED) {
-        MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+        MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     }
     goto fn_exit;
     /* --END ERROR HANDLING-- */
diff --git a/src/mpi/init/initthread.c b/src/mpi/init/initthread.c
index daf9903..bc8eb3e 100644
--- a/src/mpi/init/initthread.c
+++ b/src/mpi/init/initthread.c
@@ -171,7 +171,7 @@ static int thread_cs_init( void )
     MPIU_Assert(MPICH_MAX_LOCKS >= MPIU_NEST_NUM_MUTEXES);
 
     /* we create this at all granularities right now */
-    MPID_Thread_mutex_create(&MPIR_ThreadInfo.memalloc_mutex, &err);
+    MPID_Thread_mutex_create(&MPIR_THREAD_MEMALLOC_MUTEX, &err);
     MPIU_Assert(err == 0);
 
     /* must come after memalloc_mutex creation */
@@ -180,24 +180,24 @@ static int thread_cs_init( void )
 
 #if MPICH_THREAD_GRANULARITY == MPIR_THREAD_GRANULARITY_GLOBAL
 /* There is a single, global lock, held for the duration of an MPI call */
-    MPID_Thread_mutex_create(&MPIR_ThreadInfo.global_mutex, &err);
+    MPID_Thread_mutex_create(&MPIR_THREAD_GLOBAL_MUTEX, &err);
     MPIU_Assert(err == 0);
-    MPID_Thread_mutex_create(&MPIR_ThreadInfo.handle_mutex, &err);
+    MPID_Thread_mutex_create(&MPIR_THREAD_HANDLE_MUTEX, &err);
     MPIU_Assert(err == 0);
 
 #elif MPICH_THREAD_GRANULARITY == MPIR_THREAD_GRANULARITY_PER_OBJECT
     /* MPIR_THREAD_GRANULARITY_PER_OBJECT: Multiple locks */
-    MPID_Thread_mutex_create(&MPIR_ThreadInfo.global_mutex, &err);
+    MPID_Thread_mutex_create(&MPIR_THREAD_GLOBAL_MUTEX, &err);
     MPIU_Assert(err == 0);
-    MPID_Thread_mutex_create(&MPIR_ThreadInfo.handle_mutex, &err);
+    MPID_Thread_mutex_create(&MPIR_THREAD_HANDLE_MUTEX, &err);
     MPIU_Assert(err == 0);
-    MPID_Thread_mutex_create(&MPIR_ThreadInfo.msgq_mutex, &err);
+    MPID_Thread_mutex_create(&MPIR_THREAD_MSGQ_MUTEX, &err);
     MPIU_Assert(err == 0);
-    MPID_Thread_mutex_create(&MPIR_ThreadInfo.completion_mutex, &err);
+    MPID_Thread_mutex_create(&MPIR_THREAD_COMPLETION_MUTEX, &err);
     MPIU_Assert(err == 0);
-    MPID_Thread_mutex_create(&MPIR_ThreadInfo.ctx_mutex, &err);
+    MPID_Thread_mutex_create(&MPIR_THREAD_CTX_MUTEX, &err);
     MPIU_Assert(err == 0);
-    MPID_Thread_mutex_create(&MPIR_ThreadInfo.pmi_mutex, &err);
+    MPID_Thread_mutex_create(&MPIR_THREAD_PMI_MUTEX, &err);
     MPIU_Assert(err == 0);
 
 #elif MPICH_THREAD_GRANULARITY == MPIR_THREAD_GRANULARITY_LOCK_FREE
@@ -226,25 +226,25 @@ int MPIR_Thread_CS_Finalize( void )
     MPIU_DBG_MSG(THREAD,TYPICAL,"Freeing global mutex and private storage");
 #if MPICH_THREAD_GRANULARITY == MPIR_THREAD_GRANULARITY_GLOBAL
 /* There is a single, global lock, held for the duration of an MPI call */
-    MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.global_mutex, &err);
+    MPID_Thread_mutex_destroy(&MPIR_THREAD_GLOBAL_MUTEX, &err);
     MPIU_Assert(err == 0);
-    MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.handle_mutex, &err);
+    MPID_Thread_mutex_destroy(&MPIR_THREAD_HANDLE_MUTEX, &err);
     MPIU_Assert(err == 0);
 
 #elif MPICH_THREAD_GRANULARITY == MPIR_THREAD_GRANULARITY_PER_OBJECT
     /* MPIR_THREAD_GRANULARITY_PER_OBJECT: There are multiple locks,
      * one for each logical class (e.g., each type of object) */
-    MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.global_mutex, &err);
+    MPID_Thread_mutex_destroy(&MPIR_THREAD_GLOBAL_MUTEX, &err);
     MPIU_Assert(err == 0);
-    MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.handle_mutex, &err);
+    MPID_Thread_mutex_destroy(&MPIR_THREAD_HANDLE_MUTEX, &err);
     MPIU_Assert(err == 0);
-    MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.msgq_mutex, &err);
+    MPID_Thread_mutex_destroy(&MPIR_THREAD_MSGQ_MUTEX, &err);
     MPIU_Assert(err == 0);
-    MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.completion_mutex, &err);
+    MPID_Thread_mutex_destroy(&MPIR_THREAD_COMPLETION_MUTEX, &err);
     MPIU_Assert(err == 0);
-    MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.ctx_mutex, &err);
+    MPID_Thread_mutex_destroy(&MPIR_THREAD_CTX_MUTEX, &err);
     MPIU_Assert(err == 0);
-    MPID_Thread_mutex_destroy(&MPIR_ThreadInfo.pmi_mutex, &err);
+    MPID_Thread_mutex_destroy(&MPIR_THREAD_PMI_MUTEX, &err);
     MPIU_Assert(err == 0);
 
 
@@ -462,7 +462,7 @@ int MPIR_Init_thread(int * argc, char ***argv, int required, int * provided)
 
     /* We can't acquire any critical sections until this point.  Any
      * earlier the basic data structures haven't been initialized */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     exit_init_cs_on_failure = 1;
 
     /* create MPI_INFO_NULL object */
@@ -541,7 +541,7 @@ int MPIR_Init_thread(int * argc, char ***argv, int required, int * provided)
 	mpi_errno = MPID_InitCompleted();
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     /* Make fields of MPIR_Process global visible and set mpich_state
        atomically so that MPI_Initialized() etc. are thread safe */
     OPA_write_barrier();
@@ -554,7 +554,7 @@ fn_fail:
     OPA_store_int(&MPIR_Process.mpich_state, MPICH_PRE_INIT);
 
     if (exit_init_cs_on_failure) {
-        MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+        MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     }
 #if defined(MPICH_IS_THREADED)
     MPIR_Thread_CS_Finalize();
@@ -683,7 +683,7 @@ int MPI_Init_thread( int *argc, char ***argv, int required, int *provided )
     mpi_errno = MPIR_Err_return_comm( 0, FCNAME, mpi_errno );
     MPID_MPI_INIT_FUNC_EXIT(MPID_STATE_MPI_INIT_THREAD);
 
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return mpi_errno;
     /* --END ERROR HANDLING-- */
diff --git a/src/mpi/pt2pt/bsend.c b/src/mpi/pt2pt/bsend.c
index 9c260ba..e2a61f1 100644
--- a/src/mpi/pt2pt/bsend.c
+++ b/src/mpi/pt2pt/bsend.c
@@ -97,7 +97,7 @@ int MPI_Bsend(const void *buf, int count, MPI_Datatype datatype, int dest, int t
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER_FRONT(MPID_STATE_MPI_BSEND);
     
     /* Validate handle parameters needing to be converted */
@@ -173,7 +173,7 @@ int MPI_Bsend(const void *buf, int count, MPI_Datatype datatype, int dest, int t
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_BSEND);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 	
   fn_fail:
diff --git a/src/mpi/pt2pt/bsend_init.c b/src/mpi/pt2pt/bsend_init.c
index 6f7887d..4ba10f9 100644
--- a/src/mpi/pt2pt/bsend_init.c
+++ b/src/mpi/pt2pt/bsend_init.c
@@ -70,7 +70,7 @@ int MPI_Bsend_init(const void *buf, int count, MPI_Datatype datatype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_BSEND_INIT);
     
     /* Validate handle parameters needing to be converted */
@@ -131,7 +131,7 @@ int MPI_Bsend_init(const void *buf, int count, MPI_Datatype datatype,
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_BSEND_INIT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/bufattach.c b/src/mpi/pt2pt/bufattach.c
index bbb09dd..17b58b2 100644
--- a/src/mpi/pt2pt/bufattach.c
+++ b/src/mpi/pt2pt/bufattach.c
@@ -82,7 +82,7 @@ int MPI_Buffer_attach(void *buffer, int size)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_BUFFER_ATTACH);
     
 #   ifdef HAVE_ERROR_CHECKING
@@ -104,7 +104,7 @@ int MPI_Buffer_attach(void *buffer, int size)
     
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_BUFFER_ATTACH);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/buffree.c b/src/mpi/pt2pt/buffree.c
index fa190f9..db90f89 100644
--- a/src/mpi/pt2pt/buffree.c
+++ b/src/mpi/pt2pt/buffree.c
@@ -99,7 +99,7 @@ int MPI_Buffer_detach(void *buffer_addr, int *size)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_BUFFER_DETACH);
     
 #   ifdef HAVE_ERROR_CHECKING
@@ -121,7 +121,7 @@ int MPI_Buffer_detach(void *buffer_addr, int *size)
     
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_BUFFER_DETACH);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/cancel.c b/src/mpi/pt2pt/cancel.c
index 8085639..13a50d9 100644
--- a/src/mpi/pt2pt/cancel.c
+++ b/src/mpi/pt2pt/cancel.c
@@ -164,7 +164,7 @@ int MPI_Cancel(MPI_Request *request)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_CANCEL);
     
     /* Convert MPI object handles to object pointers */
@@ -192,7 +192,7 @@ int MPI_Cancel(MPI_Request *request)
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_CANCEL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/greq_complete.c b/src/mpi/pt2pt/greq_complete.c
index 5bb5dfc..1f296a7 100644
--- a/src/mpi/pt2pt/greq_complete.c
+++ b/src/mpi/pt2pt/greq_complete.c
@@ -72,7 +72,7 @@ int MPI_Grequest_complete( MPI_Request request )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GREQUEST_COMPLETE);
     
     /* Validate handle parameters needing to be converted */
@@ -115,7 +115,7 @@ int MPI_Grequest_complete( MPI_Request request )
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GREQUEST_COMPLETE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/pt2pt/greq_start.c b/src/mpi/pt2pt/greq_start.c
index c8d1ecd..52e28a9 100644
--- a/src/mpi/pt2pt/greq_start.c
+++ b/src/mpi/pt2pt/greq_start.c
@@ -184,7 +184,7 @@ int MPI_Grequest_start( MPI_Grequest_query_function *query_fn,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GREQUEST_START);
 
     /* Validate parameters if error checking is enabled */
@@ -209,7 +209,7 @@ int MPI_Grequest_start( MPI_Grequest_query_function *query_fn,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GREQUEST_START);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/pt2pt/ibsend.c b/src/mpi/pt2pt/ibsend.c
index 0ee0788..52e624b 100644
--- a/src/mpi/pt2pt/ibsend.c
+++ b/src/mpi/pt2pt/ibsend.c
@@ -169,7 +169,7 @@ int MPI_Ibsend(const void *buf, int count, MPI_Datatype datatype, int dest, int
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER_FRONT(MPID_STATE_MPI_IBSEND);
 
     /* Validate handle parameters needing to be converted */
@@ -232,7 +232,7 @@ int MPI_Ibsend(const void *buf, int count, MPI_Datatype datatype, int dest, int
 
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_IBSEND);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/pt2pt/improbe.c b/src/mpi/pt2pt/improbe.c
index e9eb080..808db85 100644
--- a/src/mpi/pt2pt/improbe.c
+++ b/src/mpi/pt2pt/improbe.c
@@ -59,7 +59,7 @@ int MPI_Improbe(int source, int tag, MPI_Comm comm, int *flag, MPI_Message *mess
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IMPROBE);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IMPROBE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -113,7 +113,7 @@ int MPI_Improbe(int source, int tag, MPI_Comm comm, int *flag, MPI_Message *mess
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IMPROBE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/pt2pt/imrecv.c b/src/mpi/pt2pt/imrecv.c
index 60553ed..6cff657 100644
--- a/src/mpi/pt2pt/imrecv.c
+++ b/src/mpi/pt2pt/imrecv.c
@@ -60,7 +60,7 @@ int MPI_Imrecv(void *buf, int count, MPI_Datatype datatype, MPI_Message *message
     MPID_Request *msgp = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IMRECV);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IMRECV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -121,7 +121,7 @@ int MPI_Imrecv(void *buf, int count, MPI_Datatype datatype, MPI_Message *message
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IMRECV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/pt2pt/iprobe.c b/src/mpi/pt2pt/iprobe.c
index 1784b53..74cda6e 100644
--- a/src/mpi/pt2pt/iprobe.c
+++ b/src/mpi/pt2pt/iprobe.c
@@ -64,7 +64,7 @@ int MPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_IPROBE);
     
     /* Validate handle parameters needing to be converted */
@@ -111,7 +111,7 @@ int MPI_Iprobe(int source, int tag, MPI_Comm comm, int *flag,
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_IPROBE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/irecv.c b/src/mpi/pt2pt/irecv.c
index 55959ac..ec599e2 100644
--- a/src/mpi/pt2pt/irecv.c
+++ b/src/mpi/pt2pt/irecv.c
@@ -69,7 +69,7 @@ int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER_BACK(MPID_STATE_MPI_IRECV);
 
     /* Validate handle parameters needing to be converted */
@@ -142,7 +142,7 @@ int MPI_Irecv(void *buf, int count, MPI_Datatype datatype, int source,
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT_BACK(MPID_STATE_MPI_IRECV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/irsend.c b/src/mpi/pt2pt/irsend.c
index b8b81cd..a98c3e9 100644
--- a/src/mpi/pt2pt/irsend.c
+++ b/src/mpi/pt2pt/irsend.c
@@ -70,7 +70,7 @@ int MPI_Irsend(const void *buf, int count, MPI_Datatype datatype, int dest, int
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER_FRONT(MPID_STATE_MPI_IRSEND);
 
     /* Validate handle parameters needing to be converted */
@@ -139,7 +139,7 @@ int MPI_Irsend(const void *buf, int count, MPI_Datatype datatype, int dest, int
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_IRSEND);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/pt2pt/isend.c b/src/mpi/pt2pt/isend.c
index 33d0c6c..aec119b 100644
--- a/src/mpi/pt2pt/isend.c
+++ b/src/mpi/pt2pt/isend.c
@@ -68,7 +68,7 @@ int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int t
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER_FRONT(MPID_STATE_MPI_ISEND);
 
     /* Validate handle parameters needing to be converted */
@@ -138,7 +138,7 @@ int MPI_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int t
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_ISEND);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/pt2pt/issend.c b/src/mpi/pt2pt/issend.c
index ac8d603..b2e4265 100644
--- a/src/mpi/pt2pt/issend.c
+++ b/src/mpi/pt2pt/issend.c
@@ -69,7 +69,7 @@ int MPI_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER_FRONT(MPID_STATE_MPI_ISSEND);
 
     /* Validate handle parameters needing to be converted */
@@ -138,7 +138,7 @@ int MPI_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_ISSEND);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/mprobe.c b/src/mpi/pt2pt/mprobe.c
index e4dde5e..f51f564 100644
--- a/src/mpi/pt2pt/mprobe.c
+++ b/src/mpi/pt2pt/mprobe.c
@@ -57,7 +57,7 @@ int MPI_Mprobe(int source, int tag, MPI_Comm comm, MPI_Message *message, MPI_Sta
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_MPROBE);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_MPROBE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -107,7 +107,7 @@ int MPI_Mprobe(int source, int tag, MPI_Comm comm, MPI_Message *message, MPI_Sta
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_MPROBE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/pt2pt/mrecv.c b/src/mpi/pt2pt/mrecv.c
index 1953cbe..3463cd7 100644
--- a/src/mpi/pt2pt/mrecv.c
+++ b/src/mpi/pt2pt/mrecv.c
@@ -59,7 +59,7 @@ int MPI_Mrecv(void *buf, int count, MPI_Datatype datatype, MPI_Message *message,
     MPID_Request *msgp = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_MRECV);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_MRECV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -117,7 +117,7 @@ int MPI_Mrecv(void *buf, int count, MPI_Datatype datatype, MPI_Message *message,
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_MRECV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/pt2pt/probe.c b/src/mpi/pt2pt/probe.c
index 2c18ab1..adc7ea3 100644
--- a/src/mpi/pt2pt/probe.c
+++ b/src/mpi/pt2pt/probe.c
@@ -60,7 +60,7 @@ int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_PROBE);
     
     /* Validate handle parameters needing to be converted */
@@ -104,7 +104,7 @@ int MPI_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status)
 
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_PROBE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/recv.c b/src/mpi/pt2pt/recv.c
index 8f8df21..f4a6352 100644
--- a/src/mpi/pt2pt/recv.c
+++ b/src/mpi/pt2pt/recv.c
@@ -75,7 +75,7 @@ int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER_BACK(MPID_STATE_MPI_RECV);
     
     /* Validate handle parameters needing to be converted */
@@ -189,7 +189,7 @@ int MPI_Recv(void *buf, int count, MPI_Datatype datatype, int source, int tag,
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT_BACK(MPID_STATE_MPI_RECV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/recv_init.c b/src/mpi/pt2pt/recv_init.c
index bb1d561..4d2c5f5 100644
--- a/src/mpi/pt2pt/recv_init.c
+++ b/src/mpi/pt2pt/recv_init.c
@@ -71,7 +71,7 @@ int MPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int source,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_RECV_INIT);
 
     /* Validate handle parameters needing to be converted */
@@ -136,7 +136,7 @@ int MPI_Recv_init(void *buf, int count, MPI_Datatype datatype, int source,
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_RECV_INIT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/request_free.c b/src/mpi/pt2pt/request_free.c
index d85fd06..43f8b17 100644
--- a/src/mpi/pt2pt/request_free.c
+++ b/src/mpi/pt2pt/request_free.c
@@ -72,7 +72,7 @@ int MPI_Request_free(MPI_Request *request)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_REQUEST_FREE);
     
     /* Validate handle parameters needing to be converted */
@@ -174,7 +174,7 @@ int MPI_Request_free(MPI_Request *request)
     
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_REQUEST_FREE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/request_get_status.c b/src/mpi/pt2pt/request_get_status.c
index 07269e8..522b953 100644
--- a/src/mpi/pt2pt/request_get_status.c
+++ b/src/mpi/pt2pt/request_get_status.c
@@ -62,7 +62,7 @@ int MPI_Request_get_status(MPI_Request request, int *flag, MPI_Status *status)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_REQUEST_GET_STATUS);
 
     /* Check the arguments */
@@ -246,7 +246,7 @@ int MPI_Request_get_status(MPI_Request request, int *flag, MPI_Status *status)
     
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_REQUEST_GET_STATUS);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/rsend.c b/src/mpi/pt2pt/rsend.c
index 12f4736..f8959db 100644
--- a/src/mpi/pt2pt/rsend.c
+++ b/src/mpi/pt2pt/rsend.c
@@ -66,7 +66,7 @@ int MPI_Rsend(const void *buf, int count, MPI_Datatype datatype, int dest, int t
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER_FRONT(MPID_STATE_MPI_RSEND);
     
     /* Validate handle parameters needing to be converted */
@@ -158,7 +158,7 @@ int MPI_Rsend(const void *buf, int count, MPI_Datatype datatype, int dest, int t
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_RSEND);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/pt2pt/rsend_init.c b/src/mpi/pt2pt/rsend_init.c
index 8e5e851..dfc2383 100644
--- a/src/mpi/pt2pt/rsend_init.c
+++ b/src/mpi/pt2pt/rsend_init.c
@@ -71,7 +71,7 @@ int MPI_Rsend_init(const void *buf, int count, MPI_Datatype datatype, int dest,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_RSEND_INIT);
     
     /* Validate handle parameters needing to be converted */
@@ -136,7 +136,7 @@ int MPI_Rsend_init(const void *buf, int count, MPI_Datatype datatype, int dest,
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_RSEND_INIT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/send.c b/src/mpi/pt2pt/send.c
index 7098471..862d49d 100644
--- a/src/mpi/pt2pt/send.c
+++ b/src/mpi/pt2pt/send.c
@@ -71,7 +71,7 @@ int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int ta
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER_FRONT(MPID_STATE_MPI_SEND);
     
     /* Validate handle parameters needing to be converted */
@@ -163,7 +163,7 @@ int MPI_Send(const void *buf, int count, MPI_Datatype datatype, int dest, int ta
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_SEND);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/send_init.c b/src/mpi/pt2pt/send_init.c
index 49eaa5a..8aceca5 100644
--- a/src/mpi/pt2pt/send_init.c
+++ b/src/mpi/pt2pt/send_init.c
@@ -71,7 +71,7 @@ int MPI_Send_init(const void *buf, int count, MPI_Datatype datatype, int dest,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_SEND_INIT);
     
     /* Validate handle parameters needing to be converted */
@@ -137,7 +137,7 @@ int MPI_Send_init(const void *buf, int count, MPI_Datatype datatype, int dest,
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_SEND_INIT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/sendrecv.c b/src/mpi/pt2pt/sendrecv.c
index 652320a..51abfe4 100644
--- a/src/mpi/pt2pt/sendrecv.c
+++ b/src/mpi/pt2pt/sendrecv.c
@@ -82,7 +82,7 @@ int MPI_Sendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER_BOTH(MPID_STATE_MPI_SENDRECV);
     
     /* Validate handle parameters needing to be converted */
@@ -226,7 +226,7 @@ int MPI_Sendrecv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT_BOTH(MPID_STATE_MPI_SENDRECV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/sendrecv_rep.c b/src/mpi/pt2pt/sendrecv_rep.c
index 972ab47..bcb945d 100644
--- a/src/mpi/pt2pt/sendrecv_rep.c
+++ b/src/mpi/pt2pt/sendrecv_rep.c
@@ -81,7 +81,7 @@ int MPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
     
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER_BOTH(MPID_STATE_MPI_SENDRECV_REPLACE);
 
     /* Convert handles to MPI objects. */
@@ -220,7 +220,7 @@ int MPI_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
   fn_exit:
     MPIU_CHKLMEM_FREEALL();
     MPID_MPI_PT2PT_FUNC_EXIT_BOTH(MPID_STATE_MPI_SENDRECV_REPLACE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/pt2pt/ssend.c b/src/mpi/pt2pt/ssend.c
index c17a02b..ac25461 100644
--- a/src/mpi/pt2pt/ssend.c
+++ b/src/mpi/pt2pt/ssend.c
@@ -65,7 +65,7 @@ int MPI_Ssend(const void *buf, int count, MPI_Datatype datatype, int dest, int t
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER_FRONT(MPID_STATE_MPI_SSEND);
     
     /* Validate handle parameters needing to be converted */
@@ -141,7 +141,7 @@ int MPI_Ssend(const void *buf, int count, MPI_Datatype datatype, int dest, int t
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_SSEND);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/pt2pt/ssend_init.c b/src/mpi/pt2pt/ssend_init.c
index 10d86be..9ebf263 100644
--- a/src/mpi/pt2pt/ssend_init.c
+++ b/src/mpi/pt2pt/ssend_init.c
@@ -68,7 +68,7 @@ int MPI_Ssend_init(const void *buf, int count, MPI_Datatype datatype, int dest,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_SSEND_INIT);
     
     /* Validate handle parameters needing to be converted */
@@ -133,7 +133,7 @@ int MPI_Ssend_init(const void *buf, int count, MPI_Datatype datatype, int dest,
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_SSEND_INIT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/start.c b/src/mpi/pt2pt/start.c
index 8efdb3d..5f517cf 100644
--- a/src/mpi/pt2pt/start.c
+++ b/src/mpi/pt2pt/start.c
@@ -54,7 +54,7 @@ int MPI_Start(MPI_Request *request)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_START);
 
     /* Validate handle parameters needing to be converted */
@@ -95,7 +95,7 @@ int MPI_Start(MPI_Request *request)
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_START);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/startall.c b/src/mpi/pt2pt/startall.c
index b1de944..5c18507 100644
--- a/src/mpi/pt2pt/startall.c
+++ b/src/mpi/pt2pt/startall.c
@@ -70,7 +70,7 @@ int MPI_Startall(int count, MPI_Request array_of_requests[])
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_STARTALL);
 
     /* Validate handle parameters needing to be converted */
@@ -132,7 +132,7 @@ int MPI_Startall(int count, MPI_Request array_of_requests[])
     }
 
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_STARTALL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/test.c b/src/mpi/pt2pt/test.c
index 18cf606..94ef842 100644
--- a/src/mpi/pt2pt/test.c
+++ b/src/mpi/pt2pt/test.c
@@ -117,7 +117,7 @@ int MPI_Test(MPI_Request *request, int *flag, MPI_Status *status)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_TEST);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -163,7 +163,7 @@ int MPI_Test(MPI_Request *request, int *flag, MPI_Status *status)
     
   fn_exit:
 	MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_TEST);
-	MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+	MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 	return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/pt2pt/testall.c b/src/mpi/pt2pt/testall.c
index 99699d2..a32dc99 100644
--- a/src/mpi/pt2pt/testall.c
+++ b/src/mpi/pt2pt/testall.c
@@ -238,7 +238,7 @@ int MPI_Testall(int count, MPI_Request array_of_requests[], int *flag,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_TESTALL);
 
     /* Check the arguments */
@@ -273,7 +273,7 @@ int MPI_Testall(int count, MPI_Request array_of_requests[], int *flag,
   fn_exit:
     
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_TESTALL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/testany.c b/src/mpi/pt2pt/testany.c
index 17e51a7..4096014 100644
--- a/src/mpi/pt2pt/testany.c
+++ b/src/mpi/pt2pt/testany.c
@@ -80,7 +80,7 @@ int MPI_Testany(int count, MPI_Request array_of_requests[], int *indx,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_TESTANY);
 
     /* Check the arguments */
@@ -221,7 +221,7 @@ int MPI_Testany(int count, MPI_Request array_of_requests[], int *indx,
     }
 
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_TESTANY);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/testsome.c b/src/mpi/pt2pt/testsome.c
index 95ceadf..16a17ea 100644
--- a/src/mpi/pt2pt/testsome.c
+++ b/src/mpi/pt2pt/testsome.c
@@ -84,7 +84,7 @@ int MPI_Testsome(int incount, MPI_Request array_of_requests[], int *outcount,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_TESTSOME);
 
     /* Check the arguments */
@@ -244,7 +244,7 @@ int MPI_Testsome(int incount, MPI_Request array_of_requests[], int *outcount,
     }
 
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_TESTSOME);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/pt2pt/wait.c b/src/mpi/pt2pt/wait.c
index 64f7520..c068e22 100644
--- a/src/mpi/pt2pt/wait.c
+++ b/src/mpi/pt2pt/wait.c
@@ -142,7 +142,7 @@ int MPI_Wait(MPI_Request *request, MPI_Status *status)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_WAIT);
 
     /* Check the arguments */
@@ -193,7 +193,7 @@ int MPI_Wait(MPI_Request *request, MPI_Status *status)
     
   fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_WAIT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 	
   fn_fail:
diff --git a/src/mpi/pt2pt/waitall.c b/src/mpi/pt2pt/waitall.c
index a89dd6e..a331b48 100644
--- a/src/mpi/pt2pt/waitall.c
+++ b/src/mpi/pt2pt/waitall.c
@@ -347,7 +347,7 @@ int MPI_Waitall(int count, MPI_Request array_of_requests[],
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_WAITALL);
 
     /* Check the arguments */
@@ -382,7 +382,7 @@ int MPI_Waitall(int count, MPI_Request array_of_requests[],
     
  fn_exit:
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_WAITALL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
  fn_fail:
diff --git a/src/mpi/pt2pt/waitany.c b/src/mpi/pt2pt/waitany.c
index 16d1259..75f97ec 100644
--- a/src/mpi/pt2pt/waitany.c
+++ b/src/mpi/pt2pt/waitany.c
@@ -84,7 +84,7 @@ int MPI_Waitany(int count, MPI_Request array_of_requests[], int *indx,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_WAITANY);
 
     /* Check the arguments */
@@ -226,7 +226,7 @@ int MPI_Waitany(int count, MPI_Request array_of_requests[], int *indx,
     }
 
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_WAITANY);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_progress_end_fail:
diff --git a/src/mpi/pt2pt/waitsome.c b/src/mpi/pt2pt/waitsome.c
index c80d1eb..359c8aa 100644
--- a/src/mpi/pt2pt/waitsome.c
+++ b/src/mpi/pt2pt/waitsome.c
@@ -103,7 +103,7 @@ int MPI_Waitsome(int incount, MPI_Request array_of_requests[],
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_PT2PT_FUNC_ENTER(MPID_STATE_MPI_WAITSOME);
 
     /* Check the arguments */
@@ -297,7 +297,7 @@ int MPI_Waitsome(int incount, MPI_Request array_of_requests[],
     }
 
     MPID_MPI_PT2PT_FUNC_EXIT(MPID_STATE_MPI_WAITSOME);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/accumulate.c b/src/mpi/rma/accumulate.c
index d711f4a..1bb10df 100644
--- a/src/mpi/rma/accumulate.c
+++ b/src/mpi/rma/accumulate.c
@@ -77,7 +77,7 @@ int MPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_ACCUMULATE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -155,7 +155,7 @@ int MPI_Accumulate(const void *origin_addr, int origin_count, MPI_Datatype
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_ACCUMULATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/alloc_mem.c b/src/mpi/rma/alloc_mem.c
index d6179ec..c8fc338 100644
--- a/src/mpi/rma/alloc_mem.c
+++ b/src/mpi/rma/alloc_mem.c
@@ -70,7 +70,7 @@ int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ALLOC_MEM);
     
 #   ifdef HAVE_ERROR_CHECKING
@@ -106,7 +106,7 @@ int MPI_Alloc_mem(MPI_Aint size, MPI_Info info, void *baseptr)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ALLOC_MEM);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/compare_and_swap.c b/src/mpi/rma/compare_and_swap.c
index f694811..ddc947e 100644
--- a/src/mpi/rma/compare_and_swap.c
+++ b/src/mpi/rma/compare_and_swap.c
@@ -83,7 +83,7 @@ int MPI_Compare_and_swap(const void *origin_addr, const void *compare_addr,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_COMPARE_AND_SWAP);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -143,7 +143,7 @@ int MPI_Compare_and_swap(const void *origin_addr, const void *compare_addr,
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_COMPARE_AND_SWAP);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/fetch_and_op.c b/src/mpi/rma/fetch_and_op.c
index f128f76..8138142 100644
--- a/src/mpi/rma/fetch_and_op.c
+++ b/src/mpi/rma/fetch_and_op.c
@@ -88,7 +88,7 @@ int MPI_Fetch_and_op(const void *origin_addr, void *result_addr,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_FETCH_AND_OP);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -159,7 +159,7 @@ int MPI_Fetch_and_op(const void *origin_addr, void *result_addr,
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_FETCH_AND_OP);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/free_mem.c b/src/mpi/rma/free_mem.c
index cde79bb..b701adc 100644
--- a/src/mpi/rma/free_mem.c
+++ b/src/mpi/rma/free_mem.c
@@ -52,7 +52,7 @@ int MPI_Free_mem(void *base)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_FREE_MEM);
 
     /* ... body of routine ...  */
@@ -66,7 +66,7 @@ int MPI_Free_mem(void *base)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_FREE_MEM);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/get.c b/src/mpi/rma/get.c
index c5e5f5c..1ba8e8e 100644
--- a/src/mpi/rma/get.c
+++ b/src/mpi/rma/get.c
@@ -72,7 +72,7 @@ int MPI_Get(void *origin_addr, int origin_count, MPI_Datatype
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_GET);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -148,7 +148,7 @@ int MPI_Get(void *origin_addr, int origin_count, MPI_Datatype
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_GET);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/get_accumulate.c b/src/mpi/rma/get_accumulate.c
index b541bfe..fd788b2 100644
--- a/src/mpi/rma/get_accumulate.c
+++ b/src/mpi/rma/get_accumulate.c
@@ -108,7 +108,7 @@ int MPI_Get_accumulate(const void *origin_addr, int origin_count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_GET_ACCUMULATE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -209,7 +209,7 @@ int MPI_Get_accumulate(const void *origin_addr, int origin_count,
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_GET_ACCUMULATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/put.c b/src/mpi/rma/put.c
index 7f58379..b2c593a 100644
--- a/src/mpi/rma/put.c
+++ b/src/mpi/rma/put.c
@@ -72,7 +72,7 @@ int MPI_Put(const void *origin_addr, int origin_count, MPI_Datatype
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_PUT);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -148,7 +148,7 @@ int MPI_Put(const void *origin_addr, int origin_count, MPI_Datatype
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_PUT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/raccumulate.c b/src/mpi/rma/raccumulate.c
index d8fd28d..4118978 100644
--- a/src/mpi/rma/raccumulate.c
+++ b/src/mpi/rma/raccumulate.c
@@ -91,7 +91,7 @@ int MPI_Raccumulate(const void *origin_addr, int origin_count, MPI_Datatype
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_RACCUMULATE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -172,7 +172,7 @@ int MPI_Raccumulate(const void *origin_addr, int origin_count, MPI_Datatype
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_RACCUMULATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/rget.c b/src/mpi/rma/rget.c
index cf5470e..2c1efcd 100644
--- a/src/mpi/rma/rget.c
+++ b/src/mpi/rma/rget.c
@@ -86,7 +86,7 @@ int MPI_Rget(void *origin_addr, int origin_count, MPI_Datatype
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_RGET);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -165,7 +165,7 @@ int MPI_Rget(void *origin_addr, int origin_count, MPI_Datatype
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_RGET);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/rget_accumulate.c b/src/mpi/rma/rget_accumulate.c
index 514556b..6fe8ad3 100644
--- a/src/mpi/rma/rget_accumulate.c
+++ b/src/mpi/rma/rget_accumulate.c
@@ -101,7 +101,7 @@ int MPI_Rget_accumulate(const void *origin_addr, int origin_count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_RGET_ACCUMULATE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -201,7 +201,7 @@ int MPI_Rget_accumulate(const void *origin_addr, int origin_count,
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_RGET_ACCUMULATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/rput.c b/src/mpi/rma/rput.c
index 166812a..664e19d 100644
--- a/src/mpi/rma/rput.c
+++ b/src/mpi/rma/rput.c
@@ -88,7 +88,7 @@ int MPI_Rput(const void *origin_addr, int origin_count, MPI_Datatype
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_RPUT);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -167,7 +167,7 @@ int MPI_Rput(const void *origin_addr, int origin_count, MPI_Datatype
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_RPUT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_allocate.c b/src/mpi/rma/win_allocate.c
index 2cc2914..1a0e277 100644
--- a/src/mpi/rma/win_allocate.c
+++ b/src/mpi/rma/win_allocate.c
@@ -80,7 +80,7 @@ int MPI_Win_allocate(MPI_Aint size, int disp_unit, MPI_Info info,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_ALLOCATE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -153,7 +153,7 @@ int MPI_Win_allocate(MPI_Aint size, int disp_unit, MPI_Info info,
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_ALLOCATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_allocate_shared.c b/src/mpi/rma/win_allocate_shared.c
index edc18fd..0623e68 100644
--- a/src/mpi/rma/win_allocate_shared.c
+++ b/src/mpi/rma/win_allocate_shared.c
@@ -90,7 +90,7 @@ int MPI_Win_allocate_shared(MPI_Aint size, int disp_unit, MPI_Info info, MPI_Com
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_ALLOCATE_SHARED);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -151,7 +151,7 @@ int MPI_Win_allocate_shared(MPI_Aint size, int disp_unit, MPI_Info info, MPI_Com
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_ALLOCATE_SHARED);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_attach.c b/src/mpi/rma/win_attach.c
index 2e545a2..a4fa201 100644
--- a/src/mpi/rma/win_attach.c
+++ b/src/mpi/rma/win_attach.c
@@ -69,7 +69,7 @@ int MPI_Win_attach(MPI_Win win, void *base, MPI_Aint size)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_ATTACH);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -127,7 +127,7 @@ int MPI_Win_attach(MPI_Win win, void *base, MPI_Aint size)
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_ATTACH);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_complete.c b/src/mpi/rma/win_complete.c
index 9dd42d2..c625366 100644
--- a/src/mpi/rma/win_complete.c
+++ b/src/mpi/rma/win_complete.c
@@ -54,7 +54,7 @@ int MPI_Win_complete(MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_COMPLETE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -94,7 +94,7 @@ int MPI_Win_complete(MPI_Win win)
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_COMPLETE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_create.c b/src/mpi/rma/win_create.c
index 9b3d921..a4a8ebd 100644
--- a/src/mpi/rma/win_create.c
+++ b/src/mpi/rma/win_create.c
@@ -108,7 +108,7 @@ int MPI_Win_create(void *base, MPI_Aint size, int disp_unit, MPI_Info info,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_CREATE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -181,7 +181,7 @@ int MPI_Win_create(void *base, MPI_Aint size, int disp_unit, MPI_Info info,
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_CREATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_create_dynamic.c b/src/mpi/rma/win_create_dynamic.c
index a88ab4a..84e13b3 100644
--- a/src/mpi/rma/win_create_dynamic.c
+++ b/src/mpi/rma/win_create_dynamic.c
@@ -96,7 +96,7 @@ int MPI_Win_create_dynamic(MPI_Info info, MPI_Comm comm, MPI_Win *win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_CREATE_DYNAMIC);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -145,7 +145,7 @@ int MPI_Win_create_dynamic(MPI_Info info, MPI_Comm comm, MPI_Win *win)
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_CREATE_DYNAMIC);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_detach.c b/src/mpi/rma/win_detach.c
index fc87847..098bd2d 100644
--- a/src/mpi/rma/win_detach.c
+++ b/src/mpi/rma/win_detach.c
@@ -68,7 +68,7 @@ int MPI_Win_detach(MPI_Win win, const void *base)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_DETACH);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -109,7 +109,7 @@ int MPI_Win_detach(MPI_Win win, const void *base)
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_DETACH);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_fence.c b/src/mpi/rma/win_fence.c
index c238012..c5f32cf 100644
--- a/src/mpi/rma/win_fence.c
+++ b/src/mpi/rma/win_fence.c
@@ -72,7 +72,7 @@ int MPI_Win_fence(int assert, MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_FENCE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -115,7 +115,7 @@ int MPI_Win_fence(int assert, MPI_Win win)
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_FENCE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_flush.c b/src/mpi/rma/win_flush.c
index cdcf825..cafac61 100644
--- a/src/mpi/rma/win_flush.c
+++ b/src/mpi/rma/win_flush.c
@@ -63,7 +63,7 @@ int MPI_Win_flush(int rank, MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_FLUSH);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -110,7 +110,7 @@ int MPI_Win_flush(int rank, MPI_Win win)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_FLUSH);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_flush_all.c b/src/mpi/rma/win_flush_all.c
index 5403a47..1733422 100644
--- a/src/mpi/rma/win_flush_all.c
+++ b/src/mpi/rma/win_flush_all.c
@@ -62,7 +62,7 @@ int MPI_Win_flush_all(MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_FLUSH_ALL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -104,7 +104,7 @@ int MPI_Win_flush_all(MPI_Win win)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_FLUSH_ALL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_flush_local.c b/src/mpi/rma/win_flush_local.c
index f04dc70..224705b 100644
--- a/src/mpi/rma/win_flush_local.c
+++ b/src/mpi/rma/win_flush_local.c
@@ -65,7 +65,7 @@ int MPI_Win_flush_local(int rank, MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_FLUSH_LOCAL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -112,7 +112,7 @@ int MPI_Win_flush_local(int rank, MPI_Win win)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_FLUSH_LOCAL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_flush_local_all.c b/src/mpi/rma/win_flush_local_all.c
index 133558e..7306480 100644
--- a/src/mpi/rma/win_flush_local_all.c
+++ b/src/mpi/rma/win_flush_local_all.c
@@ -61,7 +61,7 @@ int MPI_Win_flush_local_all(MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_FLUSH_LOCAL_ALL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -102,7 +102,7 @@ int MPI_Win_flush_local_all(MPI_Win win)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_FLUSH_LOCAL_ALL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_free.c b/src/mpi/rma/win_free.c
index 3630cf3..1df3951 100644
--- a/src/mpi/rma/win_free.c
+++ b/src/mpi/rma/win_free.c
@@ -57,7 +57,7 @@ int MPI_Win_free(MPI_Win *win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_FREE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -124,7 +124,7 @@ int MPI_Win_free(MPI_Win *win)
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_FREE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_get_group.c b/src/mpi/rma/win_get_group.c
index 83d8e46..fea73f7 100644
--- a/src/mpi/rma/win_get_group.c
+++ b/src/mpi/rma/win_get_group.c
@@ -66,7 +66,7 @@ int MPI_Win_get_group(MPI_Win win, MPI_Group *group)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_GET_GROUP);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -110,7 +110,7 @@ int MPI_Win_get_group(MPI_Win win, MPI_Group *group)
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_GET_GROUP);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_get_info.c b/src/mpi/rma/win_get_info.c
index d5a5ffa..90ef494 100644
--- a/src/mpi/rma/win_get_info.c
+++ b/src/mpi/rma/win_get_info.c
@@ -76,7 +76,7 @@ int MPI_Win_get_info(MPI_Win win, MPI_Info *info_used)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_GET_INFO);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -118,7 +118,7 @@ int MPI_Win_get_info(MPI_Win win, MPI_Info *info_used)
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_GET_INFO);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_lock.c b/src/mpi/rma/win_lock.c
index bbea9ac..e094c59 100644
--- a/src/mpi/rma/win_lock.c
+++ b/src/mpi/rma/win_lock.c
@@ -82,7 +82,7 @@ int MPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_LOCK);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -143,7 +143,7 @@ int MPI_Win_lock(int lock_type, int rank, int assert, MPI_Win win)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_LOCK);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_lock_all.c b/src/mpi/rma/win_lock_all.c
index 471018e..1fa806e 100644
--- a/src/mpi/rma/win_lock_all.c
+++ b/src/mpi/rma/win_lock_all.c
@@ -86,7 +86,7 @@ int MPI_Win_lock_all(int assert, MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_LOCK_ALL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -137,7 +137,7 @@ int MPI_Win_lock_all(int assert, MPI_Win win)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_LOCK_ALL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_post.c b/src/mpi/rma/win_post.c
index 4d0d176..d63bb5d 100644
--- a/src/mpi/rma/win_post.c
+++ b/src/mpi/rma/win_post.c
@@ -71,7 +71,7 @@ int MPI_Win_post(MPI_Group group, int assert, MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_POST);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -118,7 +118,7 @@ int MPI_Win_post(MPI_Group group, int assert, MPI_Win win)
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_POST);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_set_info.c b/src/mpi/rma/win_set_info.c
index eedc5e4..095da0c 100644
--- a/src/mpi/rma/win_set_info.c
+++ b/src/mpi/rma/win_set_info.c
@@ -73,7 +73,7 @@ int MPI_Win_set_info(MPI_Win win, MPI_Info info)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_SET_INFO);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -117,7 +117,7 @@ int MPI_Win_set_info(MPI_Win win, MPI_Info info)
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_SET_INFO);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_shared_query.c b/src/mpi/rma/win_shared_query.c
index 03ecfb5..0361502 100644
--- a/src/mpi/rma/win_shared_query.c
+++ b/src/mpi/rma/win_shared_query.c
@@ -80,7 +80,7 @@ int MPI_Win_shared_query(MPI_Win win, int rank, MPI_Aint *size, int *disp_unit,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_SHARED_QUERY);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -129,7 +129,7 @@ int MPI_Win_shared_query(MPI_Win win, int rank, MPI_Aint *size, int *disp_unit,
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_SHARED_QUERY);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_start.c b/src/mpi/rma/win_start.c
index 84ff952..3617b6a 100644
--- a/src/mpi/rma/win_start.c
+++ b/src/mpi/rma/win_start.c
@@ -72,7 +72,7 @@ int MPI_Win_start(MPI_Group group, int assert, MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_START);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -119,7 +119,7 @@ int MPI_Win_start(MPI_Group group, int assert, MPI_Win win)
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_START);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_sync.c b/src/mpi/rma/win_sync.c
index 6762dc1..a84b567 100644
--- a/src/mpi/rma/win_sync.c
+++ b/src/mpi/rma/win_sync.c
@@ -64,7 +64,7 @@ int MPI_Win_sync(MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_SYNC);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -104,7 +104,7 @@ int MPI_Win_sync(MPI_Win win)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_SYNC);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_test.c b/src/mpi/rma/win_test.c
index 4f9c256..17139c6 100644
--- a/src/mpi/rma/win_test.c
+++ b/src/mpi/rma/win_test.c
@@ -63,7 +63,7 @@ int MPI_Win_test(MPI_Win win, int *flag)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_TEST);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -105,7 +105,7 @@ int MPI_Win_test(MPI_Win win, int *flag)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_TEST);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_unlock.c b/src/mpi/rma/win_unlock.c
index fba5778..6a7ee8a 100644
--- a/src/mpi/rma/win_unlock.c
+++ b/src/mpi/rma/win_unlock.c
@@ -58,7 +58,7 @@ int MPI_Win_unlock(int rank, MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_UNLOCK);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -105,7 +105,7 @@ int MPI_Win_unlock(int rank, MPI_Win win)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_UNLOCK);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_unlock_all.c b/src/mpi/rma/win_unlock_all.c
index c396f87..5fc6c3b 100644
--- a/src/mpi/rma/win_unlock_all.c
+++ b/src/mpi/rma/win_unlock_all.c
@@ -65,7 +65,7 @@ int MPI_Win_unlock_all(MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_UNLOCK_ALL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -107,7 +107,7 @@ int MPI_Win_unlock_all(MPI_Win win)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_UNLOCK_ALL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/rma/win_wait.c b/src/mpi/rma/win_wait.c
index 8d49f5f..c2ba1b2 100644
--- a/src/mpi/rma/win_wait.c
+++ b/src/mpi/rma/win_wait.c
@@ -54,7 +54,7 @@ int MPI_Win_wait(MPI_Win win)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_RMA_FUNC_ENTER(MPID_STATE_MPI_WIN_WAIT);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -95,7 +95,7 @@ int MPI_Win_wait(MPI_Win win)
 
   fn_exit:
     MPID_MPI_RMA_FUNC_EXIT(MPID_STATE_MPI_WIN_WAIT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/romio/mpi-io/close.c b/src/mpi/romio/mpi-io/close.c
index ddc2a99..797c851 100644
--- a/src/mpi/romio/mpi-io/close.c
+++ b/src/mpi/romio/mpi-io/close.c
@@ -44,7 +44,7 @@ int MPI_File_close(MPI_File *fh)
     HPMP_IO_WSTART(fl_xmpi, BLKMPIFILECLOSE, TRDTBLOCK, *adio_fh);
 #endif /* MPI_hpux */
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(*fh);
 
@@ -90,7 +90,7 @@ int MPI_File_close(MPI_File *fh)
 #endif /* MPI_hpux */
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return error_code;
 fn_fail:
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/romio/mpi-io/delete.c b/src/mpi/romio/mpi-io/delete.c
index 414d270..19a2335 100644
--- a/src/mpi/romio/mpi-io/delete.c
+++ b/src/mpi/romio/mpi-io/delete.c
@@ -48,7 +48,7 @@ int MPI_File_delete(ROMIO_CONST char *filename, MPI_Info info)
 
     MPIU_UNREFERENCED_ARG(info);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     MPIR_MPIOInit(&error_code);
     if (error_code != MPI_SUCCESS) goto fn_exit;
@@ -90,6 +90,6 @@ int MPI_File_delete(ROMIO_CONST char *filename, MPI_Info info)
 #endif /* MPI_hpux */
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/fsync.c b/src/mpi/romio/mpi-io/fsync.c
index 021d01a..6bca025 100644
--- a/src/mpi/romio/mpi-io/fsync.c
+++ b/src/mpi/romio/mpi-io/fsync.c
@@ -45,7 +45,7 @@ int MPI_File_sync(MPI_File fh)
     HPMP_IO_START(fl_xmpi, BLKMPIFILESYNC, TRDTBLOCK, adio_fh,
 		  MPI_DATATYPE_NULL, -1);
 #endif /* MPI_hpux */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
     /* --BEGIN ERROR HANDLING-- */
@@ -71,6 +71,6 @@ int MPI_File_sync(MPI_File fh)
 #endif /* MPI_hpux */
  
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/get_errh.c b/src/mpi/romio/mpi-io/get_errh.c
index 304ac68..67d65d2 100644
--- a/src/mpi/romio/mpi-io/get_errh.c
+++ b/src/mpi/romio/mpi-io/get_errh.c
@@ -44,7 +44,7 @@ int MPI_File_get_errhandler(MPI_File mpi_fh, MPI_Errhandler *errhandler)
     static char myname[] = "MPI_FILE_GET_ERRHANDLER";
     MPIU_THREADPRIV_DECL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     if (mpi_fh == MPI_FILE_NULL) {
 	*errhandler = ADIOI_DFLT_ERR_HANDLER;
@@ -66,6 +66,6 @@ int MPI_File_get_errhandler(MPI_File mpi_fh, MPI_Errhandler *errhandler)
     }
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return MPI_SUCCESS;
 }
diff --git a/src/mpi/romio/mpi-io/get_group.c b/src/mpi/romio/mpi-io/get_group.c
index cf8ade0..da6c910 100644
--- a/src/mpi/romio/mpi-io/get_group.c
+++ b/src/mpi/romio/mpi-io/get_group.c
@@ -43,7 +43,7 @@ int MPI_File_get_group(MPI_File fh, MPI_Group *group)
     ADIO_File adio_fh;
     static char myname[] = "MPI_FILE_GET_GROUP";
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -59,6 +59,6 @@ int MPI_File_get_group(MPI_File fh, MPI_Group *group)
     error_code = MPI_Comm_group(adio_fh->comm, group);
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/get_info.c b/src/mpi/romio/mpi-io/get_info.c
index 65b737f..6962793 100644
--- a/src/mpi/romio/mpi-io/get_info.c
+++ b/src/mpi/romio/mpi-io/get_info.c
@@ -42,7 +42,7 @@ int MPI_File_get_info(MPI_File fh, MPI_Info *info_used)
     ADIO_File adio_fh;
     static char myname[] = "MPI_FILE_GET_INFO";
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -57,6 +57,6 @@ int MPI_File_get_info(MPI_File fh, MPI_Info *info_used)
     /* --END ERROR HANDLING-- */
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return  error_code;
 }
diff --git a/src/mpi/romio/mpi-io/get_view.c b/src/mpi/romio/mpi-io/get_view.c
index 5d8672d..1c7f9b1 100644
--- a/src/mpi/romio/mpi-io/get_view.c
+++ b/src/mpi/romio/mpi-io/get_view.c
@@ -52,7 +52,7 @@ int MPI_File_get_view(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype,
     int i, j, k, combiner;
     MPI_Datatype copy_etype, copy_filetype;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -96,7 +96,7 @@ int MPI_File_get_view(MPI_File fh, MPI_Offset *disp, MPI_Datatype *etype,
     }
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return MPI_SUCCESS;
 }
diff --git a/src/mpi/romio/mpi-io/ioreq_c2f.c b/src/mpi/romio/mpi-io/ioreq_c2f.c
index 6791b94..64b615d 100644
--- a/src/mpi/romio/mpi-io/ioreq_c2f.c
+++ b/src/mpi/romio/mpi-io/ioreq_c2f.c
@@ -56,7 +56,7 @@ MPI_Fint MPIO_Request_c2f(MPIO_Request request)
 	    return (MPI_Fint) 0;
     }
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     if (!ADIOI_Reqtable) {
 	ADIOI_Reqtable_max = 1024;
 	ADIOI_Reqtable = (MPIO_Request *)
@@ -75,7 +75,7 @@ MPI_Fint MPIO_Request_c2f(MPIO_Request request)
     ADIOI_Reqtable_ptr++;
     ADIOI_Reqtable[ADIOI_Reqtable_ptr] = request;
 
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return (MPI_Fint) ADIOI_Reqtable_ptr;
 #endif
 }
diff --git a/src/mpi/romio/mpi-io/ioreq_f2c.c b/src/mpi/romio/mpi-io/ioreq_f2c.c
index a264cda..69bed05 100644
--- a/src/mpi/romio/mpi-io/ioreq_f2c.c
+++ b/src/mpi/romio/mpi-io/ioreq_f2c.c
@@ -49,7 +49,7 @@ MPIO_Request MPIO_Request_f2c(MPI_Fint request)
     return (MPIO_Request) request;
 #else
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     
     if (!request) {
 	return MPIO_REQUEST_NULL;
@@ -65,7 +65,7 @@ MPIO_Request MPIO_Request_f2c(MPI_Fint request)
     /* --END ERROR HANDLING-- */
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return ADIOI_Reqtable[request];
 #endif
 }
diff --git a/src/mpi/romio/mpi-io/iotest.c b/src/mpi/romio/mpi-io/iotest.c
index d85fb94..2aa7302 100644
--- a/src/mpi/romio/mpi-io/iotest.c
+++ b/src/mpi/romio/mpi-io/iotest.c
@@ -56,7 +56,7 @@ int MPIO_Test(MPIO_Request *request, int *flag, MPI_Status *status)
     }
 #endif /* MPI_hpux */
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     if (*request == MPIO_REQUEST_NULL) {
 	    error_code = MPI_SUCCESS;
@@ -89,7 +89,7 @@ int MPIO_Test(MPIO_Request *request, int *flag, MPI_Status *status)
 #endif /* MPI_hpux */
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/iotestall.c b/src/mpi/romio/mpi-io/iotestall.c
index 5572061..2583294 100644
--- a/src/mpi/romio/mpi-io/iotestall.c
+++ b/src/mpi/romio/mpi-io/iotestall.c
@@ -34,7 +34,7 @@ int MPIO_Testall(int count, MPIO_Request requests[], int *flag,
     int done, i, err; 
     MPIU_THREADPRIV_DECL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     if (count == 1)  {
 	    err = MPIO_Test( requests, flag, statuses );
 	    goto fn_exit;
@@ -71,7 +71,7 @@ int MPIO_Testall(int count, MPIO_Request requests[], int *flag,
 
     err = MPI_SUCCESS;
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return err;
 }
 
diff --git a/src/mpi/romio/mpi-io/iotestany.c b/src/mpi/romio/mpi-io/iotestany.c
index e7d12df..dfa4581 100644
--- a/src/mpi/romio/mpi-io/iotestany.c
+++ b/src/mpi/romio/mpi-io/iotestany.c
@@ -34,7 +34,7 @@ int MPIO_Testany(int count, MPIO_Request requests[], int *index,
     int i, err; 
     MPIU_THREADPRIV_DECL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     if (count == 1) {
 	err = MPIO_Test( requests, flag, status );
@@ -76,6 +76,6 @@ int MPIO_Testany(int count, MPIO_Request requests[], int *index,
 
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return err;
 }
diff --git a/src/mpi/romio/mpi-io/iotestsome.c b/src/mpi/romio/mpi-io/iotestsome.c
index c9395a9..5526d6b 100644
--- a/src/mpi/romio/mpi-io/iotestsome.c
+++ b/src/mpi/romio/mpi-io/iotestsome.c
@@ -35,7 +35,7 @@ int MPIO_Testsome(int count, MPIO_Request requests[], int *outcount,
     int flag;
     MPIU_THREADPRIV_DECL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     if (count == 1) {
 	err = MPIO_Test( requests, &flag, statuses );
@@ -81,6 +81,6 @@ int MPIO_Testsome(int count, MPIO_Request requests[], int *outcount,
 
 fn_exit:
 
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return err;
 }
diff --git a/src/mpi/romio/mpi-io/iowait.c b/src/mpi/romio/mpi-io/iowait.c
index 0b8220d..28392ee 100644
--- a/src/mpi/romio/mpi-io/iowait.c
+++ b/src/mpi/romio/mpi-io/iowait.c
@@ -56,7 +56,7 @@ int MPIO_Wait(MPIO_Request *request, MPI_Status *status)
     }
 #endif /* MPI_hpux */
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     if (*request == MPIO_REQUEST_NULL) {
 	    error_code = MPI_SUCCESS;
@@ -90,7 +90,7 @@ int MPIO_Wait(MPIO_Request *request, MPI_Status *status)
 #endif /* MPI_hpux */
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/iowaitall.c b/src/mpi/romio/mpi-io/iowaitall.c
index b03208b..a45700f 100644
--- a/src/mpi/romio/mpi-io/iowaitall.c
+++ b/src/mpi/romio/mpi-io/iowaitall.c
@@ -33,7 +33,7 @@ int MPIO_Waitall( int count, MPIO_Request requests[], MPI_Status statuses[] )
     int notdone, i, flag, err; 
     MPIU_THREADPRIV_DECL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     if (count == 1)  {
 	    err = MPIO_Wait(requests, statuses);
@@ -68,7 +68,7 @@ int MPIO_Waitall( int count, MPIO_Request requests[], MPI_Status statuses[] )
     err = MPI_SUCCESS;
 fn_exit:
 
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return err;
 }
 
diff --git a/src/mpi/romio/mpi-io/iowaitany.c b/src/mpi/romio/mpi-io/iowaitany.c
index 84fa2b6..853ff6f 100644
--- a/src/mpi/romio/mpi-io/iowaitany.c
+++ b/src/mpi/romio/mpi-io/iowaitany.c
@@ -34,7 +34,7 @@ int MPIO_Waitany(int count, MPIO_Request requests[], int *index,
     int i, flag, err; 
     MPIU_THREADPRIV_DECL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     if (count == 1) {
 	err = MPIO_Wait( requests, status );
@@ -78,7 +78,7 @@ int MPIO_Waitany(int count, MPIO_Request requests[], int *index,
     } while (flag == 0);
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return err;
 }
diff --git a/src/mpi/romio/mpi-io/iowaitsome.c b/src/mpi/romio/mpi-io/iowaitsome.c
index 7145fb9..c1dc4b3 100644
--- a/src/mpi/romio/mpi-io/iowaitsome.c
+++ b/src/mpi/romio/mpi-io/iowaitsome.c
@@ -34,7 +34,7 @@ int MPIO_Waitsome(int count, MPIO_Request requests[], int *outcount,
     int i, flag, err; 
     MPIU_THREADPRIV_DECL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     if (count == 1) {
 	err = MPIO_Wait( requests, statuses );
@@ -76,6 +76,6 @@ int MPIO_Waitsome(int count, MPIO_Request requests[], int *outcount,
     } while (*outcount == 0);
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return err;
 }
diff --git a/src/mpi/romio/mpi-io/iread.c b/src/mpi/romio/mpi-io/iread.c
index 4779dd1..8225ccf 100644
--- a/src/mpi/romio/mpi-io/iread.c
+++ b/src/mpi/romio/mpi-io/iread.c
@@ -83,7 +83,7 @@ int MPIOI_File_iread(MPI_File fh, MPI_Offset offset, int file_ptr_type, void *bu
     ADIO_Offset off, bufsize;
     MPI_Offset nbytes=0;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -154,7 +154,7 @@ int MPIOI_File_iread(MPI_File fh, MPI_Offset offset, int file_ptr_type, void *bu
 			   offset, request, &error_code); 
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/iread_all.c b/src/mpi/romio/mpi-io/iread_all.c
index 5cd8b60..6679f19 100644
--- a/src/mpi/romio/mpi-io/iread_all.c
+++ b/src/mpi/romio/mpi-io/iread_all.c
@@ -89,7 +89,7 @@ int MPIOI_File_iread_all(MPI_File fh,
     ADIO_File adio_fh;
     void *xbuf=NULL, *e32_buf=NULL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -142,7 +142,7 @@ int MPIOI_File_iread_all(MPI_File fh,
     }
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/iread_sh.c b/src/mpi/romio/mpi-io/iread_sh.c
index 7e76fb3..040e10b 100644
--- a/src/mpi/romio/mpi-io/iread_sh.c
+++ b/src/mpi/romio/mpi-io/iread_sh.c
@@ -55,7 +55,7 @@ int MPI_File_iread_shared(MPI_File fh, void *buf, int count,
     ADIO_Offset off, shared_fp;
     MPI_Offset nbytes=0;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -134,7 +134,7 @@ int MPI_File_iread_shared(MPI_File fh, void *buf, int count,
     /* --END ERROR HANDLING-- */
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/iwrite.c b/src/mpi/romio/mpi-io/iwrite.c
index 5d8eb84..ffa5713 100644
--- a/src/mpi/romio/mpi-io/iwrite.c
+++ b/src/mpi/romio/mpi-io/iwrite.c
@@ -90,7 +90,7 @@ int MPIOI_File_iwrite(MPI_File fh,
     ADIO_File adio_fh;
     MPI_Offset nbytes=0;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     adio_fh = MPIO_File_resolve(fh);
 
     /* --BEGIN ERROR HANDLING-- */
@@ -162,7 +162,7 @@ int MPIOI_File_iwrite(MPI_File fh,
 			   offset, request, &error_code);
     }
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return error_code;
 }
 #endif
diff --git a/src/mpi/romio/mpi-io/iwrite_all.c b/src/mpi/romio/mpi-io/iwrite_all.c
index 3c36867..bc7dda5 100644
--- a/src/mpi/romio/mpi-io/iwrite_all.c
+++ b/src/mpi/romio/mpi-io/iwrite_all.c
@@ -84,7 +84,7 @@ int MPIOI_File_iwrite_all(MPI_File fh,
     void *e32buf=NULL;
     const void *xbuf=NULL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -131,7 +131,7 @@ int MPIOI_File_iwrite_all(MPI_File fh,
 
 fn_exit:
     if (e32buf != NULL) ADIOI_Free(e32buf);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/iwrite_sh.c b/src/mpi/romio/mpi-io/iwrite_sh.c
index eff87c8..9c9cc8b 100644
--- a/src/mpi/romio/mpi-io/iwrite_sh.c
+++ b/src/mpi/romio/mpi-io/iwrite_sh.c
@@ -55,7 +55,7 @@ int MPI_File_iwrite_shared(MPI_File fh, ROMIO_CONST void *buf, int count,
     ADIO_Offset off, shared_fp;
     static char myname[] = "MPI_FILE_IWRITE_SHARED";
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -114,7 +114,7 @@ int MPI_File_iwrite_shared(MPI_File fh, ROMIO_CONST void *buf, int count,
 			   shared_fp, request, &error_code); 
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/open.c b/src/mpi/romio/mpi-io/open.c
index 45b7fd9..940cd3d 100644
--- a/src/mpi/romio/mpi-io/open.c
+++ b/src/mpi/romio/mpi-io/open.c
@@ -59,7 +59,7 @@ int MPI_File_open(MPI_Comm comm, ROMIO_CONST char *filename, int amode,
     HPMP_IO_OPEN_START(fl_xmpi, comm);
 #endif /* MPI_hpux */
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     /* --BEGIN ERROR HANDLING-- */
     MPIO_CHECK_COMM(comm, myname, error_code);
@@ -198,7 +198,7 @@ int MPI_File_open(MPI_Comm comm, ROMIO_CONST char *filename, int amode,
 #endif /* MPI_hpux */
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return error_code;
 fn_fail:
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/romio/mpi-io/prealloc.c b/src/mpi/romio/mpi-io/prealloc.c
index 8784049..a8e3acc 100644
--- a/src/mpi/romio/mpi-io/prealloc.c
+++ b/src/mpi/romio/mpi-io/prealloc.c
@@ -48,7 +48,7 @@ int MPI_File_preallocate(MPI_File fh, MPI_Offset size)
 		  adio_fh, MPI_DATATYPE_NULL, -1);
 #endif /* MPI_hpux */
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -99,7 +99,7 @@ int MPI_File_preallocate(MPI_File fh, MPI_Offset size)
 
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     /* TODO: bcast result? */
     if (!mynod) return error_code;
diff --git a/src/mpi/romio/mpi-io/read.c b/src/mpi/romio/mpi-io/read.c
index adbdf97..08828c3 100644
--- a/src/mpi/romio/mpi-io/read.c
+++ b/src/mpi/romio/mpi-io/read.c
@@ -79,7 +79,7 @@ int MPIOI_File_read(MPI_File fh,
     ADIO_Offset off, bufsize;
     void *xbuf=NULL, *e32_buf=NULL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -180,7 +180,7 @@ int MPIOI_File_read(MPI_File fh,
     }
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/read_all.c b/src/mpi/romio/mpi-io/read_all.c
index babd719..2579047 100644
--- a/src/mpi/romio/mpi-io/read_all.c
+++ b/src/mpi/romio/mpi-io/read_all.c
@@ -80,7 +80,7 @@ int MPIOI_File_read_all(MPI_File fh,
     ADIO_File adio_fh;
     void *xbuf=NULL, *e32_buf=NULL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -135,7 +135,7 @@ int MPIOI_File_read_all(MPI_File fh,
     }
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/read_allb.c b/src/mpi/romio/mpi-io/read_allb.c
index 80c79a4..59e206a 100644
--- a/src/mpi/romio/mpi-io/read_allb.c
+++ b/src/mpi/romio/mpi-io/read_allb.c
@@ -67,7 +67,7 @@ int MPIOI_File_read_all_begin(MPI_File fh,
     ADIO_File adio_fh;
     void *xbuf=NULL, *e32_buf=NULL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -132,7 +132,7 @@ int MPIOI_File_read_all_begin(MPI_File fh,
     }
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/read_alle.c b/src/mpi/romio/mpi-io/read_alle.c
index 7cb5ef0..a77b54c 100644
--- a/src/mpi/romio/mpi-io/read_alle.c
+++ b/src/mpi/romio/mpi-io/read_alle.c
@@ -60,7 +60,7 @@ int MPIOI_File_read_all_end(MPI_File fh,
 
     MPIU_UNREFERENCED_ARG(buf);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -83,7 +83,7 @@ int MPIOI_File_read_all_end(MPI_File fh,
     adio_fh->split_coll_count = 0;
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/read_ord.c b/src/mpi/romio/mpi-io/read_ord.c
index dd6aede..6badd0a 100644
--- a/src/mpi/romio/mpi-io/read_ord.c
+++ b/src/mpi/romio/mpi-io/read_ord.c
@@ -53,7 +53,7 @@ int MPI_File_read_ordered(MPI_File fh, void *buf, int count,
     ADIO_Offset shared_fp=0;
     ADIO_File adio_fh;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -104,7 +104,7 @@ int MPI_File_read_ordered(MPI_File fh, void *buf, int count,
     /* --END ERROR HANDLING-- */
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     /* FIXME: Check for error code from ReadStridedColl? */
     return error_code;
diff --git a/src/mpi/romio/mpi-io/read_ordb.c b/src/mpi/romio/mpi-io/read_ordb.c
index 488d038..1f1c9d0 100644
--- a/src/mpi/romio/mpi-io/read_ordb.c
+++ b/src/mpi/romio/mpi-io/read_ordb.c
@@ -50,7 +50,7 @@ int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count,
     static char myname[] = "MPI_FILE_READ_ORDERED_BEGIN";
     void *xbuf=NULL, *e32_buf=NULL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -131,7 +131,7 @@ int MPI_File_read_ordered_begin(MPI_File fh, void *buf, int count,
     }
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/read_orde.c b/src/mpi/romio/mpi-io/read_orde.c
index 5220cdc..7c22247 100644
--- a/src/mpi/romio/mpi-io/read_orde.c
+++ b/src/mpi/romio/mpi-io/read_orde.c
@@ -45,7 +45,7 @@ int MPI_File_read_ordered_end(MPI_File fh, void *buf, MPI_Status *status)
 
     MPIU_UNREFERENCED_ARG(buf);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -69,7 +69,7 @@ int MPI_File_read_ordered_end(MPI_File fh, void *buf, MPI_Status *status)
     adio_fh->split_coll_count = 0;
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/read_sh.c b/src/mpi/romio/mpi-io/read_sh.c
index 4040739..e3a3e5b 100644
--- a/src/mpi/romio/mpi-io/read_sh.c
+++ b/src/mpi/romio/mpi-io/read_sh.c
@@ -52,7 +52,7 @@ int MPI_File_read_shared(MPI_File fh, void *buf, int count,
     ADIO_File adio_fh;
     void *xbuf=NULL, *e32_buf=NULL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -149,7 +149,7 @@ int MPI_File_read_shared(MPI_File fh, void *buf, int count,
 	ADIOI_Free(e32_buf);
     }
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/register_datarep.c b/src/mpi/romio/mpi-io/register_datarep.c
index 3029f5d..2c20102 100644
--- a/src/mpi/romio/mpi-io/register_datarep.c
+++ b/src/mpi/romio/mpi-io/register_datarep.c
@@ -62,7 +62,7 @@ int MPI_Register_datarep(ROMIO_CONST char *datarep,
     ADIOI_Datarep *adio_datarep;
     static char myname[] = "MPI_REGISTER_DATAREP";
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     /* --BEGIN ERROR HANDLING-- */
     /* check datarep name (use strlen instead of strnlen because
@@ -139,7 +139,7 @@ int MPI_Register_datarep(ROMIO_CONST char *datarep,
     error_code = MPI_SUCCESS;
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/seek.c b/src/mpi/romio/mpi-io/seek.c
index 0b1b057..be4f746 100644
--- a/src/mpi/romio/mpi-io/seek.c
+++ b/src/mpi/romio/mpi-io/seek.c
@@ -49,7 +49,7 @@ int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence)
     HPMP_IO_START(fl_xmpi, BLKMPIFILESEEK, TRDTBLOCK, adio_fh, MPI_DATATYPE_NULL, -1);
 #endif /* MPI_hpux */
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -134,6 +134,6 @@ int MPI_File_seek(MPI_File fh, MPI_Offset offset, int whence)
     error_code = MPI_SUCCESS;
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/seek_sh.c b/src/mpi/romio/mpi-io/seek_sh.c
index ea49fad..141bcf2 100644
--- a/src/mpi/romio/mpi-io/seek_sh.c
+++ b/src/mpi/romio/mpi-io/seek_sh.c
@@ -41,7 +41,7 @@ int MPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence)
     MPI_Offset curr_offset, eof_offset, tmp_offset;
     ADIO_File adio_fh;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -178,7 +178,7 @@ int MPI_File_seek_shared(MPI_File fh, MPI_Offset offset, int whence)
     error_code = MPI_SUCCESS;
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/set_atom.c b/src/mpi/romio/mpi-io/set_atom.c
index 0e60ba7..d338eb5 100644
--- a/src/mpi/romio/mpi-io/set_atom.c
+++ b/src/mpi/romio/mpi-io/set_atom.c
@@ -41,7 +41,7 @@ int MPI_File_set_atomicity(MPI_File fh, int flag)
     ADIO_Fcntl_t *fcntl_struct;
     ADIO_File adio_fh;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -86,6 +86,6 @@ int MPI_File_set_atomicity(MPI_File fh, int flag)
     ADIOI_Free(fcntl_struct);
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/set_errh.c b/src/mpi/romio/mpi-io/set_errh.c
index 07641ed..eec14da 100644
--- a/src/mpi/romio/mpi-io/set_errh.c
+++ b/src/mpi/romio/mpi-io/set_errh.c
@@ -42,7 +42,7 @@ int MPI_File_set_errhandler(MPI_File mpi_fh, MPI_Errhandler errhandler)
     ADIO_File fh;
     MPIU_THREADPRIV_DECL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     if (mpi_fh == MPI_FILE_NULL) {
 	ADIOI_DFLT_ERR_HANDLER = errhandler;
@@ -71,6 +71,6 @@ int MPI_File_set_errhandler(MPI_File mpi_fh, MPI_Errhandler errhandler)
     }
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/set_info.c b/src/mpi/romio/mpi-io/set_info.c
index c05b0f5..64e5227 100644
--- a/src/mpi/romio/mpi-io/set_info.c
+++ b/src/mpi/romio/mpi-io/set_info.c
@@ -40,7 +40,7 @@ int MPI_File_set_info(MPI_File fh, MPI_Info info)
     static char myname[] = "MPI_FILE_SET_INFO";
     ADIO_File adio_fh;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -58,7 +58,7 @@ fn_exit:
 	error_code = MPIO_Err_return_file(adio_fh, error_code);
     /* --END ERROR HANDLING-- */
 
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 fn_fail:
diff --git a/src/mpi/romio/mpi-io/set_size.c b/src/mpi/romio/mpi-io/set_size.c
index 9e3094f..b1f4af3 100644
--- a/src/mpi/romio/mpi-io/set_size.c
+++ b/src/mpi/romio/mpi-io/set_size.c
@@ -48,7 +48,7 @@ int MPI_File_set_size(MPI_File fh, MPI_Offset size)
 		  MPI_DATATYPE_NULL, -1);
 #endif /* MPI_hpux */
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -99,7 +99,7 @@ int MPI_File_set_size(MPI_File fh, MPI_Offset size)
 #endif /* MPI_hpux */
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/set_view.c b/src/mpi/romio/mpi-io/set_view.c
index 5470178..325ec56 100644
--- a/src/mpi/romio/mpi-io/set_view.c
+++ b/src/mpi/romio/mpi-io/set_view.c
@@ -48,7 +48,7 @@ int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype,
     ADIO_Offset shared_fp, byte_off;
     ADIO_File adio_fh;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -193,7 +193,7 @@ int MPI_File_set_view(MPI_File fh, MPI_Offset disp, MPI_Datatype etype,
 	adio_fh->is_external32 = 1;
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 fn_fail:
diff --git a/src/mpi/romio/mpi-io/write.c b/src/mpi/romio/mpi-io/write.c
index b6b92a5..51541bf 100644
--- a/src/mpi/romio/mpi-io/write.c
+++ b/src/mpi/romio/mpi-io/write.c
@@ -80,7 +80,7 @@ int MPIOI_File_write(MPI_File fh,
     void *e32buf=NULL;
     const void *xbuf=NULL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -179,7 +179,7 @@ int MPIOI_File_write(MPI_File fh,
 
 fn_exit:
     if (e32buf!= NULL) ADIOI_Free(e32buf);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/write_all.c b/src/mpi/romio/mpi-io/write_all.c
index 1957271..eea9ae8 100644
--- a/src/mpi/romio/mpi-io/write_all.c
+++ b/src/mpi/romio/mpi-io/write_all.c
@@ -81,7 +81,7 @@ int MPIOI_File_write_all(MPI_File fh,
     void *e32buf=NULL;
     const void *xbuf=NULL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -127,7 +127,7 @@ int MPIOI_File_write_all(MPI_File fh,
 
 fn_exit:
     if (e32buf != NULL) ADIOI_Free(e32buf);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/write_allb.c b/src/mpi/romio/mpi-io/write_allb.c
index 7abe14d..6f66772 100644
--- a/src/mpi/romio/mpi-io/write_allb.c
+++ b/src/mpi/romio/mpi-io/write_allb.c
@@ -67,7 +67,7 @@ int MPIOI_File_write_all_begin(MPI_File fh,
     void *e32buf=NULL;
     const void *xbuf=NULL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -125,7 +125,7 @@ int MPIOI_File_write_all_begin(MPI_File fh,
 
 fn_exit:
     if ( e32buf != NULL) ADIOI_Free(e32buf);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/write_alle.c b/src/mpi/romio/mpi-io/write_alle.c
index 6fd684a..79488cc 100644
--- a/src/mpi/romio/mpi-io/write_alle.c
+++ b/src/mpi/romio/mpi-io/write_alle.c
@@ -59,7 +59,7 @@ int MPIOI_File_write_all_end(MPI_File fh,
 
     MPIU_UNREFERENCED_ARG(buf);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -88,7 +88,7 @@ int MPIOI_File_write_all_end(MPI_File fh,
     error_code = MPI_SUCCESS;
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     return error_code;
 }
diff --git a/src/mpi/romio/mpi-io/write_ord.c b/src/mpi/romio/mpi-io/write_ord.c
index 94aec40..d8aa198 100644
--- a/src/mpi/romio/mpi-io/write_ord.c
+++ b/src/mpi/romio/mpi-io/write_ord.c
@@ -56,7 +56,7 @@ int MPI_File_write_ordered(MPI_File fh, ROMIO_CONST void *buf, int count,
     void *e32buf=NULL;
     const void *xbuf;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -120,7 +120,7 @@ int MPI_File_write_ordered(MPI_File fh, ROMIO_CONST void *buf, int count,
 
 fn_exit:
     if (e32buf != NULL) ADIOI_Free(e32buf);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     /* FIXME: Check for error code from WriteStridedColl? */
     return error_code;
diff --git a/src/mpi/romio/mpi-io/write_ordb.c b/src/mpi/romio/mpi-io/write_ordb.c
index 5584640..b741c49 100644
--- a/src/mpi/romio/mpi-io/write_ordb.c
+++ b/src/mpi/romio/mpi-io/write_ordb.c
@@ -52,7 +52,7 @@ int MPI_File_write_ordered_begin(MPI_File fh, ROMIO_CONST void *buf, int count,
     void *e32buf = NULL;
     const void *xbuf=NULL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -125,7 +125,7 @@ int MPI_File_write_ordered_begin(MPI_File fh, ROMIO_CONST void *buf, int count,
     /* --END ERROR HANDLING-- */
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     /* FIXME: Check for error code from WriteStridedColl? */
     return error_code;
diff --git a/src/mpi/romio/mpi-io/write_orde.c b/src/mpi/romio/mpi-io/write_orde.c
index 8500b9a..de28a08 100644
--- a/src/mpi/romio/mpi-io/write_orde.c
+++ b/src/mpi/romio/mpi-io/write_orde.c
@@ -45,7 +45,7 @@ int MPI_File_write_ordered_end(MPI_File fh, ROMIO_CONST void *buf, MPI_Status *s
 
     MPIU_UNREFERENCED_ARG(buf);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -70,6 +70,6 @@ int MPI_File_write_ordered_end(MPI_File fh, ROMIO_CONST void *buf, MPI_Status *s
 
 
 fn_exit:
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return MPI_SUCCESS;
 }
diff --git a/src/mpi/romio/mpi-io/write_sh.c b/src/mpi/romio/mpi-io/write_sh.c
index b21d1f4..3e9cc6b 100644
--- a/src/mpi/romio/mpi-io/write_sh.c
+++ b/src/mpi/romio/mpi-io/write_sh.c
@@ -54,7 +54,7 @@ int MPI_File_write_shared(MPI_File fh, ROMIO_CONST void *buf, int count,
     void *e32buf = NULL;
     const void *xbuf = NULL;
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
     adio_fh = MPIO_File_resolve(fh);
 
@@ -144,6 +144,6 @@ int MPI_File_write_shared(MPI_File fh, ROMIO_CONST void *buf, int count,
 
 fn_exit:
     if (e32buf != NULL) ADIOI_Free(e32buf);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return error_code;
 }
diff --git a/src/mpi/spawn/close_port.c b/src/mpi/spawn/close_port.c
index 95a8d5c..8c3b2f1 100644
--- a/src/mpi/spawn/close_port.c
+++ b/src/mpi/spawn/close_port.c
@@ -57,7 +57,7 @@ int MPI_Close_port(const char *port_name)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_CLOSE_PORT);
 
     /* ... body of routine ...  */
@@ -69,7 +69,7 @@ int MPI_Close_port(const char *port_name)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_CLOSE_PORT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/spawn/comm_accept.c b/src/mpi/spawn/comm_accept.c
index 389874c..4fc7bdc 100644
--- a/src/mpi/spawn/comm_accept.c
+++ b/src/mpi/spawn/comm_accept.c
@@ -75,7 +75,7 @@ int MPI_Comm_accept(const char *port_name, MPI_Info info, int root, MPI_Comm com
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_ACCEPT);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -118,7 +118,7 @@ int MPI_Comm_accept(const char *port_name, MPI_Info info, int root, MPI_Comm com
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_ACCEPT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/spawn/comm_connect.c b/src/mpi/spawn/comm_connect.c
index 2cd0e21..88bdfd6 100644
--- a/src/mpi/spawn/comm_connect.c
+++ b/src/mpi/spawn/comm_connect.c
@@ -74,7 +74,7 @@ int MPI_Comm_connect(const char *port_name, MPI_Info info, int root, MPI_Comm co
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_CONNECT);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -118,7 +118,7 @@ int MPI_Comm_connect(const char *port_name, MPI_Info info, int root, MPI_Comm co
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_CONNECT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/spawn/comm_disconnect.c b/src/mpi/spawn/comm_disconnect.c
index 08c30b4..2957345 100644
--- a/src/mpi/spawn/comm_disconnect.c
+++ b/src/mpi/spawn/comm_disconnect.c
@@ -59,7 +59,7 @@ int MPI_Comm_disconnect(MPI_Comm * comm)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_DISCONNECT);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -132,7 +132,7 @@ int MPI_Comm_disconnect(MPI_Comm * comm)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_DISCONNECT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/spawn/comm_join.c b/src/mpi/spawn/comm_join.c
index 7793117..334a6c8 100644
--- a/src/mpi/spawn/comm_join.c
+++ b/src/mpi/spawn/comm_join.c
@@ -144,7 +144,7 @@ int MPI_Comm_join(int fd, MPI_Comm *intercomm)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_JOIN);
 
     /* ... body of routine ...  */
@@ -186,7 +186,7 @@ int MPI_Comm_join(int fd, MPI_Comm *intercomm)
   fn_exit:
     MPIU_CHKLMEM_FREEALL();
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_JOIN);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/spawn/comm_spawn.c b/src/mpi/spawn/comm_spawn.c
index c596d7c..77e4386 100644
--- a/src/mpi/spawn/comm_spawn.c
+++ b/src/mpi/spawn/comm_spawn.c
@@ -72,7 +72,7 @@ int MPI_Comm_spawn(const char *command, char *argv[], int maxprocs, MPI_Info inf
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_SPAWN);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -133,7 +133,7 @@ int MPI_Comm_spawn(const char *command, char *argv[], int maxprocs, MPI_Info inf
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_SPAWN);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/spawn/comm_spawn_multiple.c b/src/mpi/spawn/comm_spawn_multiple.c
index 3d65fe3..b45fa87 100644
--- a/src/mpi/spawn/comm_spawn_multiple.c
+++ b/src/mpi/spawn/comm_spawn_multiple.c
@@ -78,7 +78,7 @@ int MPI_Comm_spawn_multiple(int count, char *array_of_commands[],
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_SPAWN_MULTIPLE);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -151,7 +151,7 @@ int MPI_Comm_spawn_multiple(int count, char *array_of_commands[],
   fn_exit:
     MPIU_CHKLMEM_FREEALL();
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_SPAWN_MULTIPLE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/spawn/open_port.c b/src/mpi/spawn/open_port.c
index 3c3fcb5..b64c1ed 100644
--- a/src/mpi/spawn/open_port.c
+++ b/src/mpi/spawn/open_port.c
@@ -73,7 +73,7 @@ int MPI_Open_port(MPI_Info info, char *port_name)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_OPEN_PORT);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -112,7 +112,7 @@ int MPI_Open_port(MPI_Info info, char *port_name)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_OPEN_PORT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/spawn/publish_name.c b/src/mpi/spawn/publish_name.c
index ad8f753..de66c00 100644
--- a/src/mpi/spawn/publish_name.c
+++ b/src/mpi/spawn/publish_name.c
@@ -62,7 +62,7 @@ int MPI_Publish_name(const char *service_name, MPI_Info info, const char *port_n
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_PUBLISH_NAME);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -122,7 +122,7 @@ int MPI_Publish_name(const char *service_name, MPI_Info info, const char *port_n
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_PUBLISH_NAME);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
     
   fn_fail:
diff --git a/src/mpi/spawn/unpublish_name.c b/src/mpi/spawn/unpublish_name.c
index 54bbe59..47bd5a2 100644
--- a/src/mpi/spawn/unpublish_name.c
+++ b/src/mpi/spawn/unpublish_name.c
@@ -59,7 +59,7 @@ int MPI_Unpublish_name(const char *service_name, MPI_Info info, const char *port
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);  
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);  
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_UNPUBLISH_NAME);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -122,7 +122,7 @@ int MPI_Unpublish_name(const char *service_name, MPI_Info info, const char *port
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_UNPUBLISH_NAME);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/topo/cart_create.c b/src/mpi/topo/cart_create.c
index ef1e73f..564d09b 100644
--- a/src/mpi/topo/cart_create.c
+++ b/src/mpi/topo/cart_create.c
@@ -245,7 +245,7 @@ int MPI_Cart_create(MPI_Comm comm_old, int ndims, const int dims[],
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_CART_CREATE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -307,7 +307,7 @@ int MPI_Cart_create(MPI_Comm comm_old, int ndims, const int dims[],
 
  fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_CART_CREATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
  fn_fail:
diff --git a/src/mpi/topo/cart_sub.c b/src/mpi/topo/cart_sub.c
index e163633..84398f0 100644
--- a/src/mpi/topo/cart_sub.c
+++ b/src/mpi/topo/cart_sub.c
@@ -68,7 +68,7 @@ int MPI_Cart_sub(MPI_Comm comm, const int remain_dims[], MPI_Comm *newcomm)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_CART_SUB);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -199,7 +199,7 @@ int MPI_Cart_sub(MPI_Comm comm, const int remain_dims[], MPI_Comm *newcomm)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_CART_SUB);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/topo/dist_gr_create.c b/src/mpi/topo/dist_gr_create.c
index 170c587..c27f70e 100644
--- a/src/mpi/topo/dist_gr_create.c
+++ b/src/mpi/topo/dist_gr_create.c
@@ -99,7 +99,7 @@ int MPI_Dist_graph_create(MPI_Comm comm_old, int n, const int sources[],
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_DIST_GRAPH_CREATE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -408,7 +408,7 @@ int MPI_Dist_graph_create(MPI_Comm comm_old, int n, const int sources[],
     MPIU_CHKLMEM_FREEALL();
 
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_DIST_GRAPH_CREATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/topo/dist_gr_create_adj.c b/src/mpi/topo/dist_gr_create_adj.c
index a6df38b..e90fc08 100644
--- a/src/mpi/topo/dist_gr_create_adj.c
+++ b/src/mpi/topo/dist_gr_create_adj.c
@@ -84,7 +84,7 @@ int MPI_Dist_graph_create_adjacent(MPI_Comm comm_old,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_DIST_GRAPH_CREATE_ADJACENT);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -182,7 +182,7 @@ int MPI_Dist_graph_create_adjacent(MPI_Comm comm_old,
     /* ... end of body of routine ... */
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_DIST_GRAPH_CREATE_ADJACENT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/topo/dist_gr_neighb.c b/src/mpi/topo/dist_gr_neighb.c
index 8d1d261..4246bcc 100644
--- a/src/mpi/topo/dist_gr_neighb.c
+++ b/src/mpi/topo/dist_gr_neighb.c
@@ -97,7 +97,7 @@ int MPI_Dist_graph_neighbors(MPI_Comm comm,
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
     /* FIXME: Why does this routine need a CS */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_DIST_GRAPH_NEIGHBORS);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -144,7 +144,7 @@ int MPI_Dist_graph_neighbors(MPI_Comm comm,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_DIST_GRAPH_NEIGHBORS);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/topo/dist_gr_neighb_count.c b/src/mpi/topo/dist_gr_neighb_count.c
index 94087ea..caddf10 100644
--- a/src/mpi/topo/dist_gr_neighb_count.c
+++ b/src/mpi/topo/dist_gr_neighb_count.c
@@ -82,7 +82,7 @@ int MPI_Dist_graph_neighbors_count(MPI_Comm comm, int *indegree, int *outdegree,
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
     /* FIXME: Why does this routine require a CS? */
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_DIST_GRAPH_NEIGHBORS_COUNT);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -124,7 +124,7 @@ int MPI_Dist_graph_neighbors_count(MPI_Comm comm, int *indegree, int *outdegree,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_DIST_GRAPH_NEIGHBORS_COUNT);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/topo/graphcreate.c b/src/mpi/topo/graphcreate.c
index b97f31d..0da6e25 100644
--- a/src/mpi/topo/graphcreate.c
+++ b/src/mpi/topo/graphcreate.c
@@ -177,7 +177,7 @@ int MPI_Graph_create(MPI_Comm comm_old, int nnodes, const int indx[],
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_GRAPH_CREATE);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -310,7 +310,7 @@ int MPI_Graph_create(MPI_Comm comm_old, int nnodes, const int indx[],
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_GRAPH_CREATE);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/topo/inhb_allgather.c b/src/mpi/topo/inhb_allgather.c
index bfe9254..24da679 100644
--- a/src/mpi/topo/inhb_allgather.c
+++ b/src/mpi/topo/inhb_allgather.c
@@ -146,7 +146,7 @@ int MPI_Ineighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype sen
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_INEIGHBOR_ALLGATHER);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INEIGHBOR_ALLGATHER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -208,7 +208,7 @@ int MPI_Ineighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype sen
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INEIGHBOR_ALLGATHER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/topo/inhb_allgatherv.c b/src/mpi/topo/inhb_allgatherv.c
index bcad5a7..85f6be3 100644
--- a/src/mpi/topo/inhb_allgatherv.c
+++ b/src/mpi/topo/inhb_allgatherv.c
@@ -151,7 +151,7 @@ int MPI_Ineighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype se
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_INEIGHBOR_ALLGATHERV);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INEIGHBOR_ALLGATHERV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -214,7 +214,7 @@ int MPI_Ineighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype se
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INEIGHBOR_ALLGATHERV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/topo/inhb_alltoall.c b/src/mpi/topo/inhb_alltoall.c
index d1fbb46..a0eb573 100644
--- a/src/mpi/topo/inhb_alltoall.c
+++ b/src/mpi/topo/inhb_alltoall.c
@@ -152,7 +152,7 @@ int MPI_Ineighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype send
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_INEIGHBOR_ALLTOALL);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INEIGHBOR_ALLTOALL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -214,7 +214,7 @@ int MPI_Ineighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype send
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INEIGHBOR_ALLTOALL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/topo/inhb_alltoallv.c b/src/mpi/topo/inhb_alltoallv.c
index 6b7bb75..70ce0e7 100644
--- a/src/mpi/topo/inhb_alltoallv.c
+++ b/src/mpi/topo/inhb_alltoallv.c
@@ -157,7 +157,7 @@ int MPI_Ineighbor_alltoallv(const void *sendbuf, const int sendcounts[], const i
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_INEIGHBOR_ALLTOALLV);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INEIGHBOR_ALLTOALLV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -218,7 +218,7 @@ int MPI_Ineighbor_alltoallv(const void *sendbuf, const int sendcounts[], const i
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INEIGHBOR_ALLTOALLV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/topo/inhb_alltoallw.c b/src/mpi/topo/inhb_alltoallw.c
index 0644f48..a489c93 100644
--- a/src/mpi/topo/inhb_alltoallw.c
+++ b/src/mpi/topo/inhb_alltoallw.c
@@ -148,7 +148,7 @@ int MPI_Ineighbor_alltoallw(const void *sendbuf, const int sendcounts[], const M
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_INEIGHBOR_ALLTOALLW);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_INEIGHBOR_ALLTOALLW);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -191,7 +191,7 @@ int MPI_Ineighbor_alltoallw(const void *sendbuf, const int sendcounts[], const M
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_INEIGHBOR_ALLTOALLW);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/topo/nhb_allgather.c b/src/mpi/topo/nhb_allgather.c
index 3ef42ea..e0837ca 100644
--- a/src/mpi/topo/nhb_allgather.c
+++ b/src/mpi/topo/nhb_allgather.c
@@ -106,7 +106,7 @@ int MPI_Neighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype send
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_NEIGHBOR_ALLGATHER);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_NEIGHBOR_ALLGATHER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -163,7 +163,7 @@ int MPI_Neighbor_allgather(const void *sendbuf, int sendcount, MPI_Datatype send
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_NEIGHBOR_ALLGATHER);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/topo/nhb_allgatherv.c b/src/mpi/topo/nhb_allgatherv.c
index 97b621d..6320c74 100644
--- a/src/mpi/topo/nhb_allgatherv.c
+++ b/src/mpi/topo/nhb_allgatherv.c
@@ -107,7 +107,7 @@ int MPI_Neighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sen
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_NEIGHBOR_ALLGATHERV);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_NEIGHBOR_ALLGATHERV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -164,7 +164,7 @@ int MPI_Neighbor_allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sen
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_NEIGHBOR_ALLGATHERV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/topo/nhb_alltoall.c b/src/mpi/topo/nhb_alltoall.c
index c6629d8..1dff5c7 100644
--- a/src/mpi/topo/nhb_alltoall.c
+++ b/src/mpi/topo/nhb_alltoall.c
@@ -110,7 +110,7 @@ int MPI_Neighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendt
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_NEIGHBOR_ALLTOALL);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_NEIGHBOR_ALLTOALL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -167,7 +167,7 @@ int MPI_Neighbor_alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendt
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_NEIGHBOR_ALLTOALL);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/topo/nhb_alltoallv.c b/src/mpi/topo/nhb_alltoallv.c
index 1233985..99e8c80 100644
--- a/src/mpi/topo/nhb_alltoallv.c
+++ b/src/mpi/topo/nhb_alltoallv.c
@@ -105,7 +105,7 @@ int MPI_Neighbor_alltoallv(const void *sendbuf, const int sendcounts[], const in
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_NEIGHBOR_ALLTOALLV);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_NEIGHBOR_ALLTOALLV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -162,7 +162,7 @@ int MPI_Neighbor_alltoallv(const void *sendbuf, const int sendcounts[], const in
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_NEIGHBOR_ALLTOALLV);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/topo/nhb_alltoallw.c b/src/mpi/topo/nhb_alltoallw.c
index f67d187..686c26c 100644
--- a/src/mpi/topo/nhb_alltoallw.c
+++ b/src/mpi/topo/nhb_alltoallw.c
@@ -105,7 +105,7 @@ int MPI_Neighbor_alltoallw(const void *sendbuf, const int sendcounts[], const MP
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_NEIGHBOR_ALLTOALLW);
 
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_NEIGHBOR_ALLTOALLW);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -147,7 +147,7 @@ int MPI_Neighbor_alltoallw(const void *sendbuf, const int sendcounts[], const MP
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_NEIGHBOR_ALLTOALLW);
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_poll.c b/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_poll.c
index c03be70..4ee8677 100644
--- a/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_poll.c
+++ b/src/mpid/ch3/channels/nemesis/netmod/mxm/mxm_poll.c
@@ -236,9 +236,9 @@ static int _mxm_handle_rreq(MPID_Request * req)
     MPID_nem_mxm_req_area *req_area = NULL;
     void *tmp_buf = NULL;
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     found = MPIDI_CH3U_Recvq_DP(req);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     /* an MPI_ANY_SOURCE request may have been previously removed from the
      * CH3 queue by an FDP (find and dequeue posted) operation */
     if (req->dev.match.parts.rank != MPI_ANY_SOURCE) {
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_isend.c b/src/mpid/ch3/channels/nemesis/src/ch3_isend.c
index e1d1b40..862efa7 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_isend.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_isend.c
@@ -46,7 +46,7 @@ int MPIDI_CH3_iSend (MPIDI_VC_t *vc, MPID_Request *sreq, void * hdr, MPIDI_msg_s
     hdr_sz = sizeof(MPIDI_CH3_Pkt_t);
     MPIDI_DBG_Print_packet((MPIDI_CH3_Pkt_t*)hdr);
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     in_cs = TRUE;
 
     if (MPIDI_CH3I_Sendq_empty(MPIDI_CH3I_shm_sendq))
@@ -88,7 +88,7 @@ int MPIDI_CH3_iSend (MPIDI_VC_t *vc, MPID_Request *sreq, void * hdr, MPIDI_msg_s
 
  fn_exit:
     if (in_cs) {
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     }
 
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_ISEND);
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_isendv.c b/src/mpid/ch3/channels/nemesis/src/ch3_isendv.c
index 35ade04..e89dcc7 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_isendv.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_isendv.c
@@ -63,7 +63,7 @@ int MPIDI_CH3_iSendv (MPIDI_VC_t *vc, MPID_Request *sreq, MPL_IOV *iov, int n_io
     iov[0].MPL_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
     MPIDI_DBG_Print_packet((MPIDI_CH3_Pkt_t *)iov[0].MPL_IOV_BUF);
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     in_cs = TRUE;
 
     if (MPIDI_CH3I_Sendq_empty(MPIDI_CH3I_shm_sendq))
@@ -185,7 +185,7 @@ int MPIDI_CH3_iSendv (MPIDI_VC_t *vc, MPID_Request *sreq, MPL_IOV *iov, int n_io
 
  fn_exit:
     if (in_cs) {
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     }
 
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_ISENDV);
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_istartmsg.c b/src/mpid/ch3/channels/nemesis/src/ch3_istartmsg.c
index 406e170..3ff067f 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_istartmsg.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_istartmsg.c
@@ -49,7 +49,7 @@ int MPIDI_CH3_iStartMsg (MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hdr_sz, MPID_
     hdr_sz = sizeof(MPIDI_CH3_Pkt_t);
     MPIDI_DBG_Print_packet((MPIDI_CH3_Pkt_t*)hdr);
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     in_cs = 1;
 
     if (MPIDI_CH3I_Sendq_empty(MPIDI_CH3I_shm_sendq))
@@ -75,7 +75,7 @@ int MPIDI_CH3_iStartMsg (MPIDI_VC_t *vc, void *hdr, MPIDI_msg_sz_t hdr_sz, MPID_
 
  fn_exit:
     if (in_cs) {
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     }
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_ISTARTMSG);
     return mpi_errno;
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_istartmsgv.c b/src/mpid/ch3/channels/nemesis/src/ch3_istartmsgv.c
index 12b9469..d4792f0 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_istartmsgv.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_istartmsgv.c
@@ -71,7 +71,7 @@ int MPIDI_CH3_iStartMsgv (MPIDI_VC_t *vc, MPL_IOV *iov, int n_iov, MPID_Request
     iov[0].MPL_IOV_LEN = sizeof(MPIDI_CH3_Pkt_t);
     MPIDI_DBG_Print_packet((MPIDI_CH3_Pkt_t*)iov[0].MPL_IOV_BUF);
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     in_cs = TRUE;
 
     if (MPIDI_CH3I_Sendq_empty(MPIDI_CH3I_shm_sendq))
@@ -184,7 +184,7 @@ int MPIDI_CH3_iStartMsgv (MPIDI_VC_t *vc, MPL_IOV *iov, int n_iov, MPID_Request
 
  fn_exit:
     if (in_cs) {
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     }
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3_ISTARTMSGV);
     return mpi_errno;
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3_progress.c b/src/mpid/ch3/channels/nemesis/src/ch3_progress.c
index 9b1e6c7..b2e5d21 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3_progress.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3_progress.c
@@ -304,7 +304,7 @@ int MPIDI_CH3I_Progress_register_hook(int (*progress_fn)(int*), int *id)
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_REGISTER_HOOK);
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_REGISTER_HOOK);
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     for (i = 0; i < MAX_PROGRESS_HOOKS; i++) {
         if (progress_hooks[i].func_ptr == NULL) {
@@ -323,7 +323,7 @@ int MPIDI_CH3I_Progress_register_hook(int (*progress_fn)(int*), int *id)
     (*id) = i;
 
   fn_exit:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS_REGISTER_HOOK);
     return mpi_errno;
 
@@ -341,7 +341,7 @@ int MPIDI_CH3I_Progress_deregister_hook(int id)
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_DEREGISTER_HOOK);
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_DEREGISTER_HOOK);
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     MPIU_Assert(id >= 0 && id < MAX_PROGRESS_HOOKS && progress_hooks[id].func_ptr != NULL);
 
@@ -349,7 +349,7 @@ int MPIDI_CH3I_Progress_deregister_hook(int id)
     progress_hooks[id].active = FALSE;
 
   fn_exit:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS_DEREGISTER_HOOK);
     return mpi_errno;
 
@@ -368,7 +368,7 @@ int MPIDI_CH3I_Progress_activate_hook(int id)
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_ACTIVATE_HOOK);
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_ACTIVATE_HOOK);
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     MPIU_Assert(id >= 0 && id < MAX_PROGRESS_HOOKS &&
                 progress_hooks[id].active == FALSE && progress_hooks[id].func_ptr != NULL);
@@ -378,7 +378,7 @@ int MPIDI_CH3I_Progress_activate_hook(int id)
     MPIU_Assert(total_progress_hook_cnt <= MAX_PROGRESS_HOOKS);
 
   fn_exit:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS_ACTIVATE_HOOK);
     return mpi_errno;
 
@@ -397,7 +397,7 @@ int MPIDI_CH3I_Progress_deactivate_hook(int id)
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_DEACTIVATE_HOOK);
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_DEACTIVATE_HOOK);
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     MPIU_Assert(id >= 0 && id < MAX_PROGRESS_HOOKS &&
                 progress_hooks[id].active == TRUE && progress_hooks[id].func_ptr != NULL);
@@ -407,7 +407,7 @@ int MPIDI_CH3I_Progress_deactivate_hook(int id)
     MPIU_Assert(total_progress_hook_cnt >= 0);
 
   fn_exit:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS_DEACTIVATE_HOOK);
     return mpi_errno;
 
@@ -430,7 +430,7 @@ int MPIDI_CH3I_Progress (MPID_Progress_state *progress_state, int is_blocking)
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS);
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     /* sanity: if this doesn't hold, we can't track our local view of completion safely */
     if (is_blocking) {
@@ -632,7 +632,7 @@ int MPIDI_CH3I_Progress (MPID_Progress_state *progress_state, int is_blocking)
         {
             if (is_blocking) {
                 MPIDI_CH3I_progress_blocked = TRUE;
-                MPID_THREAD_CS_YIELD(GLOBAL, MPIR_ThreadInfo.global_mutex);
+                MPID_THREAD_CS_YIELD(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
                 /* MPIDCOMM yield is needed because at least the send
                  * functions acquire MPIDCOMM to put things into the send
                  * queues.  Failure to yield could result in a deadlock.
@@ -643,7 +643,7 @@ int MPIDI_CH3I_Progress (MPID_Progress_state *progress_state, int is_blocking)
                  * sections besides the MPIDCOMM CS at this point.
                  * Violating this will probably lead to lock-ordering
                  * deadlocks. */
-                MPID_THREAD_CS_YIELD(POBJ, MPIR_ThreadInfo.global_mutex);
+                MPID_THREAD_CS_YIELD(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
                 MPIDI_CH3I_progress_blocked = FALSE;
                 MPIDI_CH3I_progress_wakeup_signalled = FALSE;
             }
@@ -668,7 +668,7 @@ int MPIDI_CH3I_Progress (MPID_Progress_state *progress_state, int is_blocking)
 #endif
 
  fn_exit:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS);
     return mpi_errno;
  fn_fail:
@@ -691,7 +691,7 @@ static int MPIDI_CH3I_Progress_delay(unsigned int completion_count)
     /* FIXME should be appropriately abstracted somehow */
 #   if defined(MPICH_IS_THREADED) && (MPICH_THREAD_GRANULARITY == MPIR_THREAD_GRANULARITY_GLOBAL)
     {
-        MPID_Thread_cond_wait(&MPIDI_CH3I_progress_completion_cond, &MPIR_ThreadInfo.global_mutex/*MPIDCOMM*/, &err);
+        MPID_Thread_cond_wait(&MPIDI_CH3I_progress_completion_cond, &MPIR_THREAD_GLOBAL_MUTEX/*MPIDCOMM*/, &err);
     }
 #   endif
 
diff --git a/src/mpid/ch3/channels/nemesis/src/ch3i_eagernoncontig.c b/src/mpid/ch3/channels/nemesis/src/ch3i_eagernoncontig.c
index e5b35d7..53014b0 100644
--- a/src/mpid/ch3/channels/nemesis/src/ch3i_eagernoncontig.c
+++ b/src/mpid/ch3/channels/nemesis/src/ch3i_eagernoncontig.c
@@ -29,7 +29,7 @@ int MPIDI_CH3I_SendNoncontig( MPIDI_VC_t *vc, MPID_Request *sreq, void *header,
 
     MPIDI_DBG_Print_packet((MPIDI_CH3_Pkt_t *)header);
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     if (!MPIDI_CH3I_Sendq_empty(MPIDI_CH3I_shm_sendq)) /* MT */
     {
@@ -96,7 +96,7 @@ int MPIDI_CH3I_SendNoncontig( MPIDI_VC_t *vc, MPID_Request *sreq, void *header,
     }
 
  fn_exit:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_SENDNONCONTIG);
     return mpi_errno;
  fn_fail:
diff --git a/src/mpid/ch3/channels/nemesis/src/mpid_nem_init.c b/src/mpid/ch3/channels/nemesis/src/mpid_nem_init.c
index 2a00df4..19bb8da 100644
--- a/src/mpid/ch3/channels/nemesis/src/mpid_nem_init.c
+++ b/src/mpid/ch3/channels/nemesis/src/mpid_nem_init.c
@@ -478,7 +478,7 @@ MPID_nem_vc_init (MPIDI_VC_t *vc)
     /* MT we acquire the LMT CS here, b/c there is at least a theoretical race
      * on some fields, such as lmt_copy_buf.  In practice it's not an issue, but
      * this will keep DRD happy. */
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     /* override rendezvous functions */
     vc->rndvSend_fn = MPID_nem_lmt_RndvSend;
@@ -599,7 +599,7 @@ MPID_nem_vc_init (MPIDI_VC_t *vc)
 
     }
 
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     /* FIXME: ch3 assumes there is a field called sendq_head in the ch
        portion of the vc.  This is unused in nemesis and should be set
diff --git a/src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt.c b/src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt.c
index ce6da0c..6fd751e 100644
--- a/src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt.c
+++ b/src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt.c
@@ -122,13 +122,13 @@ int MPID_nem_lmt_RndvSend(MPID_Request **sreq_p, const void * buf, MPI_Aint coun
     MPIDI_Request_set_seqnum(sreq, seqnum);
     sreq->ch.vc = vc;
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     mpi_errno = vc->ch.lmt_initiate_lmt(vc, &upkt.p, sreq);
     if (MPIR_CVAR_ENABLE_FT) {
         if (MPI_SUCCESS == mpi_errno)
             MPID_nem_lmt_rtsq_enqueue(&vc->ch.lmt_rts_queue, sreq);
     }
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
  fn_exit:
@@ -193,7 +193,7 @@ static int pkt_RTS_handler(MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_msg_sz_t
 
     MPIDI_FUNC_ENTER(MPID_STATE_PKT_RTS_HANDLER);
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 
     MPIU_DBG_MSG_FMT(CH3_OTHER,VERBOSE,(MPIU_DBG_FDEST, "received LMT RTS pkt, sreq=0x%08x, rank=%d, tag=%d, context=%d, data_sz=" MPIDI_MSG_SZ_FMT,
                                         rts_pkt->sender_req_id, rts_pkt->match.parts.rank, rts_pkt->match.parts.tag, rts_pkt->match.parts.context_id,
@@ -289,7 +289,7 @@ static int pkt_RTS_handler(MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_msg_sz_t
     
     MPIU_CHKPMEM_COMMIT();
  fn_exit:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     MPIDI_FUNC_EXIT(MPID_STATE_PKT_RTS_HANDLER);
     return mpi_errno;
  fn_fail:
@@ -321,12 +321,12 @@ static int pkt_CTS_handler(MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_msg_sz_t
 
     MPID_Request_get_ptr(cts_pkt->sender_req_id, sreq);
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     if (MPIR_CVAR_ENABLE_FT) {
         /* Remove the request from the VC RTS queue. */
         MPID_nem_lmt_rtsq_search_remove(&vc->ch.lmt_rts_queue, cts_pkt->sender_req_id, &rts_sreq);
     }
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     sreq->ch.lmt_req_id = cts_pkt->receiver_req_id;
     sreq->ch.lmt_data_sz = cts_pkt->data_sz;
@@ -348,9 +348,9 @@ static int pkt_CTS_handler(MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_msg_sz_t
             /* if whole cookie has been received, start the send */
             sreq->ch.lmt_tmp_cookie.MPL_IOV_BUF = data_buf;
             sreq->ch.lmt_tmp_cookie.MPL_IOV_LEN = cts_pkt->cookie_len;
-            MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+            MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
             mpi_errno = vc->ch.lmt_start_send(vc, sreq, sreq->ch.lmt_tmp_cookie);
-            MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+            MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
             if (mpi_errno) MPIR_ERR_POP (mpi_errno);
             sreq->ch.lmt_tmp_cookie.MPL_IOV_LEN = 0;
             *buflen = sizeof(MPIDI_CH3_Pkt_t) + cts_pkt->cookie_len;
@@ -378,9 +378,9 @@ static int pkt_CTS_handler(MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_msg_sz_t
     else
     {
         MPL_IOV cookie = {0,0};
-        MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+        MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
         mpi_errno = vc->ch.lmt_start_send(vc, sreq, cookie);
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
         if (mpi_errno) MPIR_ERR_POP (mpi_errno);
         *buflen = sizeof(MPIDI_CH3_Pkt_t);
         *rreqp = NULL;
@@ -411,7 +411,7 @@ static int pkt_DONE_handler(MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_msg_sz_t
     *buflen = sizeof(MPIDI_CH3_Pkt_t);
     MPID_Request_get_ptr(done_pkt->req_id, req);
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     switch (MPIDI_Request_get_type(req))
     {
@@ -434,7 +434,7 @@ static int pkt_DONE_handler(MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_msg_sz_t
     *rreqp = NULL;
 
  fn_exit:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     MPIDI_FUNC_EXIT(MPID_STATE_PKT_DONE_HANDLER);
     return mpi_errno;
  fn_fail:
@@ -480,9 +480,9 @@ static int pkt_COOKIE_handler(MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_msg_sz
 
             cookie.MPL_IOV_BUF = data_buf;
             cookie.MPL_IOV_LEN = cookie_pkt->cookie_len;
-            MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+            MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
             mpi_errno = vc->ch.lmt_handle_cookie(vc, req, cookie);
-            MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+            MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
             if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
             *rreqp = NULL;
@@ -510,9 +510,9 @@ static int pkt_COOKIE_handler(MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt, MPIDI_msg_sz
     {
         MPL_IOV cookie = {0,0};
 
-        MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+        MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
         mpi_errno = vc->ch.lmt_handle_cookie(vc, req, cookie);
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
         if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         *buflen = sizeof(MPIDI_CH3_Pkt_t);
         *rreqp = NULL;
@@ -556,9 +556,9 @@ static int do_cts(MPIDI_VC_t *vc, MPID_Request *rreq, int *complete)
 
     s_cookie = rreq->ch.lmt_tmp_cookie;
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     mpi_errno = vc->ch.lmt_start_recv(vc, rreq, s_cookie);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* free cookie buffer allocated in RTS handler */
@@ -592,9 +592,9 @@ static int do_send(MPIDI_VC_t *vc, MPID_Request *rreq, int *complete)
 
     r_cookie = sreq->ch.lmt_tmp_cookie;
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     mpi_errno = vc->ch.lmt_start_send(vc, sreq, r_cookie);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* free cookie buffer allocated in CTS handler */
@@ -625,9 +625,9 @@ static int do_cookie(MPIDI_VC_t *vc, MPID_Request *rreq, int *complete)
 
     cookie = req->ch.lmt_tmp_cookie;
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     mpi_errno = vc->ch.lmt_handle_cookie(vc, req, cookie);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     if (mpi_errno) MPIR_ERR_POP (mpi_errno);
 
     /* free cookie buffer allocated in COOKIE handler */
diff --git a/src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt_shm.c b/src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt_shm.c
index 0c799ef..57fe247 100644
--- a/src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt_shm.c
+++ b/src/mpid/ch3/channels/nemesis/src/mpid_nem_lmt_shm.c
@@ -825,13 +825,13 @@ int MPID_nem_lmt_shm_vc_terminated(MPIDI_VC_t *vc)
 
     /* If there is anything in the RTS queue, it needs to be cleared out. */
     if (MPIR_CVAR_ENABLE_FT) {
-        MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+        MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
         while (!MPID_nem_lmt_rtsq_empty(vc_ch->lmt_rts_queue)) {
             MPID_nem_lmt_rtsq_dequeue(&vc_ch->lmt_rts_queue, &req);
             req->status.MPI_ERROR = req_errno;
             MPID_Request_complete(req);
         }
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     }
 
     /* We empty the vc queue, but don't remove the vc from the global
diff --git a/src/mpid/ch3/channels/sock/include/mpidi_ch3_post.h b/src/mpid/ch3/channels/sock/include/mpidi_ch3_post.h
index 952023e..2d45e94 100644
--- a/src/mpid/ch3/channels/sock/include/mpidi_ch3_post.h
+++ b/src/mpid/ch3/channels/sock/include/mpidi_ch3_post.h
@@ -23,10 +23,10 @@
  */
 #define MPIDI_CH3_Progress_start(progress_state_)			\
 {									\
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);\
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);\
     (progress_state_)->ch.completion_count = MPIDI_CH3I_progress_completion_count;\
 }
-#define MPIDI_CH3_Progress_end(progress_state_) MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex)
+#define MPIDI_CH3_Progress_end(progress_state_) MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX)
 #define MPIDI_CH3_Progress_poke() (MPIDI_CH3_Progress_test())
 
 int MPIDI_CH3I_Progress(int blocking, MPID_Progress_state *state);
diff --git a/src/mpid/ch3/channels/sock/src/ch3_progress.c b/src/mpid/ch3/channels/sock/src/ch3_progress.c
index 0baaf32..e6b4f2f 100644
--- a/src/mpid/ch3/channels/sock/src/ch3_progress.c
+++ b/src/mpid/ch3/channels/sock/src/ch3_progress.c
@@ -755,7 +755,7 @@ static int MPIDI_CH3I_Progress_delay(unsigned int completion_count)
 	while (completion_count == MPIDI_CH3I_progress_completion_count)
 	{
 	    MPID_Thread_cond_wait(&MPIDI_CH3I_progress_completion_cond, 
-				  &MPIR_ThreadInfo.global_mutex, &err);
+				  &MPIR_THREAD_GLOBAL_MUTEX, &err);
 	}
     }
 #   endif
@@ -989,7 +989,7 @@ int MPIDI_CH3I_Progress_register_hook(int (*progress_fn)(int*), int *id)
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_REGISTER_HOOK);
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_REGISTER_HOOK);
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     for (i = 0; i < MAX_PROGRESS_HOOKS; i++) {
         if (progress_hooks[i].func_ptr == NULL) {
@@ -1008,7 +1008,7 @@ int MPIDI_CH3I_Progress_register_hook(int (*progress_fn)(int*), int *id)
     (*id) = i;
 
   fn_exit:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS_REGISTER_HOOK);
     return mpi_errno;
 
@@ -1026,7 +1026,7 @@ int MPIDI_CH3I_Progress_deregister_hook(int id)
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_DEREGISTER_HOOK);
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_DEREGISTER_HOOK);
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     MPIU_Assert(id >= 0 && id < MAX_PROGRESS_HOOKS && progress_hooks[id].func_ptr != NULL);
 
@@ -1034,7 +1034,7 @@ int MPIDI_CH3I_Progress_deregister_hook(int id)
     progress_hooks[id].active = FALSE;
 
   fn_exit:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS_DEREGISTER_HOOK);
     return mpi_errno;
 
@@ -1052,7 +1052,7 @@ int MPIDI_CH3I_Progress_activate_hook(int id)
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_ACTIVATE_HOOK);
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_ACTIVATE_HOOK);
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     MPIU_Assert(id >= 0 && id < MAX_PROGRESS_HOOKS &&
                 progress_hooks[id].active == FALSE && progress_hooks[id].func_ptr != NULL);
@@ -1062,7 +1062,7 @@ int MPIDI_CH3I_Progress_activate_hook(int id)
     MPIU_Assert(total_progress_hook_cnt <= MAX_PROGRESS_HOOKS);
 
   fn_exit:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS_ACTIVATE_HOOK);
     return mpi_errno;
 
@@ -1081,7 +1081,7 @@ int MPIDI_CH3I_Progress_deactivate_hook(int id)
     MPIDI_STATE_DECL(MPID_STATE_MPIDI_CH3I_PROGRESS_DEACTIVATE_HOOK);
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDI_CH3I_PROGRESS_DEACTIVATE_HOOK);
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     MPIU_Assert(id >= 0 && id < MAX_PROGRESS_HOOKS &&
                 progress_hooks[id].active == TRUE && progress_hooks[id].func_ptr != NULL);
@@ -1091,7 +1091,7 @@ int MPIDI_CH3I_Progress_deactivate_hook(int id)
     MPIU_Assert(total_progress_hook_cnt >= 0);
 
   fn_exit:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3I_PROGRESS_DEACTIVATE_HOOK);
     return mpi_errno;
 
diff --git a/src/mpid/ch3/include/mpidimpl.h b/src/mpid/ch3/include/mpidimpl.h
index 55631dc..cb8aa79 100644
--- a/src/mpid/ch3/include/mpidimpl.h
+++ b/src/mpid/ch3/include/mpidimpl.h
@@ -260,7 +260,7 @@ extern MPIDI_Process_t MPIDI_Process;
         if (!MPIU_THREADPRIV_FIELD(request_handles)) {                 \
             MPID_Request *prev, *cur;                                  \
             /* batch allocate a linked list of requests */             \
-            MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.handle_mutex);                        \
+            MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_HANDLE_MUTEX);                        \
             prev = MPIU_Handle_obj_alloc_unsafe(&MPID_Request_mem);    \
             prev->next = NULL;                                         \
             assert(prev);                                              \
@@ -270,7 +270,7 @@ extern MPIDI_Process_t MPIDI_Process;
                 cur->next = prev;                                      \
                 prev = cur;                                            \
             }                                                          \
-            MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.handle_mutex);                         \
+            MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_HANDLE_MUTEX);                         \
             MPIU_THREADPRIV_FIELD(request_handles) = cur;              \
             MPIU_THREADPRIV_FIELD(request_handle_count) += MPID_REQUEST_TLS_MAX;    \
         }                                                              \
@@ -1225,12 +1225,12 @@ int MPIDI_CH3I_Get_accumulate(const void *origin_addr, int origin_count,
 #ifndef MPIDI_CH3I_INCR_PROGRESS_COMPLETION_COUNT
 #define MPIDI_CH3I_INCR_PROGRESS_COMPLETION_COUNT                                \
     do {                                                                         \
-        MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.completion_mutex);                                       \
+        MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_COMPLETION_MUTEX);                                       \
         ++MPIDI_CH3I_progress_completion_count;                                  \
         MPIU_DBG_MSG_D(CH3_PROGRESS,VERBOSE,                                     \
                      "just incremented MPIDI_CH3I_progress_completion_count=%d", \
                      MPIDI_CH3I_progress_completion_count);                      \
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.completion_mutex);                                        \
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_COMPLETION_MUTEX);                                        \
     } while (0)
 #endif
 
diff --git a/src/mpid/ch3/src/ch3u_comm_spawn_multiple.c b/src/mpid/ch3/src/ch3u_comm_spawn_multiple.c
index c56ec4c..915b964 100644
--- a/src/mpid/ch3/src/ch3u_comm_spawn_multiple.c
+++ b/src/mpid/ch3/src/ch3u_comm_spawn_multiple.c
@@ -173,9 +173,9 @@ int MPIDI_Comm_spawn_multiple(int count, char **commands,
                 */
             }
             /* XXX DJG don't need this, PMI API is thread-safe? */
-            /*MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.pmi_mutex);*/
+            /*MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_PMI_MUTEX);*/
             /* release the global CS for spawn PMI calls */
-            MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+            MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
             pmi_errno = PMI2_Job_Spawn(count, (const char **)commands,
                                        argcs, (const char ***)argvs,
                                        maxprocs,
@@ -184,8 +184,8 @@ int MPIDI_Comm_spawn_multiple(int count, char **commands,
                                        NULL, 0,
                                        /*jobId, jobIdSize,*/ /* XXX DJG job stuff? */
                                        pmi_errcodes);
-            MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
-            /*MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.pmi_mutex);*/
+            MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
+            /*MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_PMI_MUTEX);*/
             MPIU_Free(argcs);
             if (pmi_errno != PMI2_SUCCESS) {
                 MPIR_ERR_SETANDJUMP1(mpi_errno, MPI_ERR_OTHER,
@@ -225,7 +225,7 @@ int MPIDI_Comm_spawn_multiple(int count, char **commands,
         preput_keyval_vector.val = port_name;
 
 
-        MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.pmi_mutex);
+        MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_PMI_MUTEX);
         pmi_errno = PMI_Spawn_multiple(count, (const char **)
                                        commands, 
                                        (const char ***) argvs,
@@ -234,7 +234,7 @@ int MPIDI_Comm_spawn_multiple(int count, char **commands,
                                        info_keyval_vectors, 1, 
                                        &preput_keyval_vector,
                                        pmi_errcodes);
-	MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.pmi_mutex);
+	MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_PMI_MUTEX);
         if (pmi_errno != PMI_SUCCESS) {
 	    MPIR_ERR_SETANDJUMP1(mpi_errno, MPI_ERR_OTHER,
 		 "**pmi_spawn_multiple", "**pmi_spawn_multiple %d", pmi_errno);
@@ -339,16 +339,16 @@ int MPIDI_CH3_GetParentPort(char ** parent_port)
 #ifdef USE_PMI2_API
         {
             int vallen = 0;
-            MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.pmi_mutex);
+            MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_PMI_MUTEX);
             pmi_errno = PMI2_KVS_Get(kvsname, PMI2_ID_NULL, PARENT_PORT_KVSKEY, val, sizeof(val), &vallen);
-            MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.pmi_mutex);
+            MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_PMI_MUTEX);
             if (pmi_errno)
                 MPIR_ERR_SETANDJUMP1(mpi_errno, MPI_ERR_OTHER, "**pmi_kvsget", "**pmi_kvsget %s", PARENT_PORT_KVSKEY);
         }
 #else
-	MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.pmi_mutex);
+	MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_PMI_MUTEX);
 	pmi_errno = PMI_KVS_Get( kvsname, PARENT_PORT_KVSKEY, val, sizeof(val));
-	MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.pmi_mutex);
+	MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_PMI_MUTEX);
 	if (pmi_errno) {
             mpi_errno = MPIR_Err_create_code(MPI_SUCCESS, MPIR_ERR_FATAL, FCNAME, __LINE__, MPI_ERR_OTHER, "**pmi_kvsget", "**pmi_kvsget %d", pmi_errno);
             goto fn_exit;
diff --git a/src/mpid/ch3/src/ch3u_eager.c b/src/mpid/ch3/src/ch3u_eager.c
index 63073a2..9cf33a2 100644
--- a/src/mpid/ch3/src/ch3u_eager.c
+++ b/src/mpid/ch3/src/ch3u_eager.c
@@ -296,7 +296,7 @@ int MPIDI_CH3_PktHandler_EagerShortSend( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
     int found;
     int mpi_errno = MPI_SUCCESS;
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 
     /* printf( "Receiving short eager!\n" ); fflush(stdout); */
     MPIU_DBG_MSG_FMT(CH3_OTHER,VERBOSE,(MPIU_DBG_FDEST,
@@ -508,7 +508,7 @@ int MPIDI_CH3_PktHandler_EagerShortSend( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
     /* MT note: it may be possible to narrow this CS after careful
      * consideration.  Note though that the (!found) case must be wholly
      * protected by this CS. */
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     return mpi_errno;
 }
 
@@ -615,7 +615,7 @@ int MPIDI_CH3_PktHandler_EagerSend( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
     MPIDI_msg_sz_t data_len;
     int mpi_errno = MPI_SUCCESS;
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 
     MPIU_DBG_MSG_FMT(CH3_OTHER,VERBOSE,(MPIU_DBG_FDEST,
 	"received eager send pkt, sreq=0x%08x, rank=%d, tag=%d, context=%d",
@@ -685,7 +685,7 @@ int MPIDI_CH3_PktHandler_EagerSend( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
     }
 
  fn_fail:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     return mpi_errno;
 }
 
diff --git a/src/mpid/ch3/src/ch3u_recvq.c b/src/mpid/ch3/src/ch3u_recvq.c
index 4d98758..b081a3e 100644
--- a/src/mpid/ch3/src/ch3u_recvq.c
+++ b/src/mpid/ch3/src/ch3u_recvq.c
@@ -683,7 +683,7 @@ int MPIDI_CH3U_Recvq_DP(MPID_Request * rreq)
     prev_rreq = NULL;
 
     /* MT FIXME is this right? or should the caller do this? */
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     MPIR_T_PVAR_TIMER_START(RECVQ, time_failed_matching_postedq);
     cur_rreq = recvq_posted_head;
     while (cur_rreq != NULL) {
@@ -713,7 +713,7 @@ int MPIDI_CH3U_Recvq_DP(MPID_Request * rreq)
     if (!found)
         MPIR_T_PVAR_TIMER_END(RECVQ, time_failed_matching_postedq);
 
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDI_CH3U_RECVQ_DP);
     return found;
@@ -1132,7 +1132,7 @@ int MPIDI_CH3U_Complete_posted_with_error(MPIDI_VC_t *vc)
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIDU_COMPLETE_POSTED_WITH_ERROR);
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 
     MPIR_ERR_SETSIMPLE(error, MPIX_ERR_PROC_FAILED, "**proc_failed");
 
@@ -1150,7 +1150,7 @@ int MPIDI_CH3U_Complete_posted_with_error(MPIDI_VC_t *vc)
     }
     
  fn_exit:
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 
     MPIDI_FUNC_EXIT(MPID_STATE_MPIDU_COMPLETE_POSTED_WITH_ERROR);
     return mpi_errno;
diff --git a/src/mpid/ch3/src/ch3u_rndv.c b/src/mpid/ch3/src/ch3u_rndv.c
index 829dc3b..bdff365 100644
--- a/src/mpid/ch3/src/ch3u_rndv.c
+++ b/src/mpid/ch3/src/ch3u_rndv.c
@@ -124,7 +124,7 @@ int MPIDI_CH3_PktHandler_RndvReqToSend( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
 		    rts_pkt->match.parts.rank,rts_pkt->data_sz,
 		    "ReceivedRndv");
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     rreq = MPIDI_CH3U_Recvq_FDP_or_AEU(&rts_pkt->match, &found);
     MPIR_ERR_CHKANDJUMP1(!rreq, mpi_errno,MPI_ERR_OTHER, "**nomemreq", "**nomemuereq %d", MPIDI_CH3U_Recvq_count_unexp());
 
@@ -138,7 +138,7 @@ int MPIDI_CH3_PktHandler_RndvReqToSend( MPIDI_VC_t *vc, MPIDI_CH3_Pkt_t *pkt,
     
     set_request_info(rreq, rts_pkt, MPIDI_REQUEST_RNDV_MSG);
 
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 
     *buflen = sizeof(MPIDI_CH3_Pkt_t);
     
diff --git a/src/mpid/ch3/src/mpid_cancel_send.c b/src/mpid/ch3/src/mpid_cancel_send.c
index 7510dfe..5caff05 100644
--- a/src/mpid/ch3/src/mpid_cancel_send.c
+++ b/src/mpid/ch3/src/mpid_cancel_send.c
@@ -56,9 +56,9 @@ int MPID_Cancel_send(MPID_Request * sreq)
 	MPIU_DBG_MSG(CH3_OTHER,VERBOSE,
 		     "attempting to cancel message sent to self");
 	
-	MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+	MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 	rreq = MPIDI_CH3U_Recvq_FDU(sreq->handle, &sreq->dev.match);
-	MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+	MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 	if (rreq)
 	{
 	    MPIU_Assert(rreq->partner_request == sreq);
diff --git a/src/mpid/ch3/src/mpid_comm_revoke.c b/src/mpid/ch3/src/mpid_comm_revoke.c
index de1f613..d4f75d5 100644
--- a/src/mpid/ch3/src/mpid_comm_revoke.c
+++ b/src/mpid/ch3/src/mpid_comm_revoke.c
@@ -84,9 +84,9 @@ int MPID_Comm_revoke(MPID_Comm *comm_ptr, int is_remote)
          * aren't any unexpected messages hanging around. */
 
         /* Clean up the receive and unexpected queues */
-        MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+        MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
         MPIDI_CH3U_Clean_recvq(comm_ptr);
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     } else if (is_remote)  { /* If this is local, we've already revoked and don't need to do it again. */
         /* Decrement the revoke counter */
         comm_ptr->dev.waiting_for_revoke--;
diff --git a/src/mpid/ch3/src/mpid_improbe.c b/src/mpid/ch3/src/mpid_improbe.c
index 9cdb8dc..f9a615a 100644
--- a/src/mpid/ch3/src/mpid_improbe.c
+++ b/src/mpid/ch3/src/mpid_improbe.c
@@ -42,9 +42,9 @@ int MPID_Improbe(int source, int tag, MPID_Comm *comm, int context_offset,
                If still not found, call progress, and check again. */
 
             /* check shm*/
-            MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+            MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
             *message = MPIDI_CH3U_Recvq_FDU_matchonly(source, tag, context_id, comm, flag);
-            MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+            MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
             if (!*flag) {
                 /* not found, check network */
                 mpi_errno = MPIDI_Anysource_improbe_fn(tag, comm, context_offset, flag, message, status);
@@ -54,9 +54,9 @@ int MPID_Improbe(int source, int tag, MPID_Comm *comm, int context_offset,
                     mpi_errno = MPIDI_CH3_Progress_poke();
                     if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     /* check shm again */
-                    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+                    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
                     *message = MPIDI_CH3U_Recvq_FDU_matchonly(source, tag, context_id, comm, flag);
-                    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+                    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
                     if (!*flag) {
                         /* check network again */
                         mpi_errno = MPIDI_Anysource_improbe_fn(tag, comm, context_offset, flag, message, status);
@@ -80,9 +80,9 @@ int MPID_Improbe(int source, int tag, MPID_Comm *comm, int context_offset,
     }
 #endif
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     *message = MPIDI_CH3U_Recvq_FDU_matchonly(source, tag, context_id, comm, flag);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 
     if (!*flag) {
         /* Always try to advance progress before returning failure
@@ -93,9 +93,9 @@ int MPID_Improbe(int source, int tag, MPID_Comm *comm, int context_offset,
            had changed */
         mpi_errno = MPID_Progress_poke();
         if (mpi_errno) MPIR_ERR_POP(mpi_errno);
-        MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+        MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
         *message = MPIDI_CH3U_Recvq_FDU_matchonly(source, tag, context_id, comm, flag);
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     }
 
     if (*flag && *message) {
diff --git a/src/mpid/ch3/src/mpid_iprobe.c b/src/mpid/ch3/src/mpid_iprobe.c
index 176db5c..713bf86 100644
--- a/src/mpid/ch3/src/mpid_iprobe.c
+++ b/src/mpid/ch3/src/mpid_iprobe.c
@@ -46,9 +46,9 @@ int MPID_Iprobe(int source, int tag, MPID_Comm *comm, int context_offset,
                If still not found, call progress, and check again. */
 
             /* check shm*/
-            MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+            MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
             found = MPIDI_CH3U_Recvq_FU(source, tag, context, status);
-            MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+            MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
             if (!found) {
                 /* not found, check network */
                 mpi_errno = MPIDI_Anysource_iprobe_fn(tag, comm, context_offset, &found, status);
@@ -58,9 +58,9 @@ int MPID_Iprobe(int source, int tag, MPID_Comm *comm, int context_offset,
                     mpi_errno = MPIDI_CH3_Progress_poke();
                     if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     /* check shm again */
-                    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+                    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
                     found = MPIDI_CH3U_Recvq_FU(source, tag, context, status);
-                    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+                    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
                     if (!found) {
                         /* check network again */
                         mpi_errno = MPIDI_Anysource_iprobe_fn(tag, comm, context_offset, &found, status);
@@ -90,9 +90,9 @@ int MPID_Iprobe(int source, int tag, MPID_Comm *comm, int context_offset,
        a request.  Note that in some cases it will be possible to 
        atomically query the unexpected receive list (which is what the
        probe routines are for). */
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     found = MPIDI_CH3U_Recvq_FU( source, tag, context, status );
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     if (!found) {
 	/* Always try to advance progress before returning failure
 	   from the iprobe test.  */
@@ -101,9 +101,9 @@ int MPID_Iprobe(int source, int tag, MPID_Comm *comm, int context_offset,
 	   a second test of the receive queue if we knew that nothing
 	   had changed */
 	mpi_errno = MPID_Progress_poke();
-	MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+	MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 	found = MPIDI_CH3U_Recvq_FU( source, tag, context, status );
-	MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+	MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     }
 	
     *flag = found;
diff --git a/src/mpid/ch3/src/mpid_irecv.c b/src/mpid/ch3/src/mpid_irecv.c
index fdf766d..8f19987 100644
--- a/src/mpid/ch3/src/mpid_irecv.c
+++ b/src/mpid/ch3/src/mpid_irecv.c
@@ -39,13 +39,13 @@ int MPID_Irecv(void * buf, MPI_Aint count, MPI_Datatype datatype, int rank, int
         MPIR_ERR_SETANDJUMP(mpi_errno,MPIX_ERR_REVOKED,"**revoked");
     }
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     rreq = MPIDI_CH3U_Recvq_FDU_or_AEP(rank, tag, 
 				       comm->recvcontext_id + context_offset,
                                        comm, buf, count, datatype, &found);
     if (rreq == NULL)
     {
-	MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+	MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 	MPIR_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomemreq");
     }
 
@@ -58,7 +58,7 @@ int MPID_Irecv(void * buf, MPI_Aint count, MPI_Datatype datatype, int rank, int
 
 	/* Release the message queue - we've removed this request from 
 	   the queue already */
-	MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+	MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 
 	if (MPIDI_Request_get_msg_type(rreq) == MPIDI_REQUEST_EAGER_MSG)
 	{
@@ -160,7 +160,7 @@ int MPID_Irecv(void * buf, MPI_Aint count, MPI_Datatype datatype, int rank, int
 	/* We must wait until here to exit the msgqueue critical section
 	   on this request (we needed to set the recv_pending_count
 	   and the datatype pointer) */
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     }
 
   fn_exit:
diff --git a/src/mpid/ch3/src/mpid_mprobe.c b/src/mpid/ch3/src/mpid_mprobe.c
index 2d7ac25..3ef7a20 100644
--- a/src/mpid/ch3/src/mpid_mprobe.c
+++ b/src/mpid/ch3/src/mpid_mprobe.c
@@ -40,16 +40,16 @@ int MPID_Mprobe(int source, int tag, MPID_Comm *comm, int context_offset,
                queue and improbing the netmod, then do a progress
                test to make some progress. */
             do {
-                MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+                MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
                 *message = MPIDI_CH3U_Recvq_FDU_matchonly(source, tag, context_id, comm,&found);
-                MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+                MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
                 if (found) goto fn_exit;
 
                 mpi_errno = MPIDI_Anysource_improbe_fn(tag, comm, context_offset, &found, message, status);
                 if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 if (found) goto fn_exit;
 
-                MPID_THREAD_CS_YIELD(GLOBAL, MPIR_ThreadInfo.global_mutex);
+                MPID_THREAD_CS_YIELD(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
                 /* FIXME could this be replaced with a progress_wait? */
                 mpi_errno = MPIDI_CH3_Progress_test();
@@ -69,7 +69,7 @@ int MPID_Mprobe(int source, int tag, MPID_Comm *comm, int context_offset,
                     if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     if (found) goto fn_exit;
 
-                    MPID_THREAD_CS_YIELD(GLOBAL, MPIR_ThreadInfo.global_mutex);
+                    MPID_THREAD_CS_YIELD(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 
                     /* FIXME could this be replaced with a progress_wait? */
                     mpi_errno = MPIDI_CH3_Progress_test();
@@ -93,9 +93,9 @@ int MPID_Mprobe(int source, int tag, MPID_Comm *comm, int context_offset,
     MPIDI_CH3_Progress_start(&progress_state);
     do
     {
-        MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+        MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
         *message = MPIDI_CH3U_Recvq_FDU_matchonly(source, tag, context_id, comm, &found);
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
         if (found)
             break;
 
diff --git a/src/mpid/ch3/src/mpid_probe.c b/src/mpid/ch3/src/mpid_probe.c
index 853e4da..b21c1e7 100644
--- a/src/mpid/ch3/src/mpid_probe.c
+++ b/src/mpid/ch3/src/mpid_probe.c
@@ -42,16 +42,16 @@ int MPID_Probe(int source, int tag, MPID_Comm * comm, int context_offset,
             do {
                 int found;
                 
-                MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+                MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
                 found = MPIDI_CH3U_Recvq_FU(source, tag, context, status);
-                MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+                MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
                 if (found) goto fn_exit;
 
                 mpi_errno = MPIDI_Anysource_iprobe_fn(tag, comm, context_offset, &found, status);
                 if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 if (found) goto fn_exit;
 
-                MPID_THREAD_CS_YIELD(GLOBAL, MPIR_ThreadInfo.global_mutex);
+                MPID_THREAD_CS_YIELD(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
                 
                 mpi_errno = MPIDI_CH3_Progress_test();
                 if (mpi_errno) MPIR_ERR_POP(mpi_errno);
@@ -71,7 +71,7 @@ int MPID_Probe(int source, int tag, MPID_Comm * comm, int context_offset,
                     if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     if (found) goto fn_exit;
                     
-                    MPID_THREAD_CS_YIELD(GLOBAL, MPIR_ThreadInfo.global_mutex);
+                    MPID_THREAD_CS_YIELD(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
                     
                     mpi_errno = MPIDI_CH3_Progress_test();
                     if (mpi_errno) MPIR_ERR_POP(mpi_errno);
@@ -86,9 +86,9 @@ int MPID_Probe(int source, int tag, MPID_Comm * comm, int context_offset,
     {
         int found;
 
-        MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+        MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
         found = MPIDI_CH3U_Recvq_FU(source, tag, context, status);
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
         if (found) break;
 
 	mpi_errno = MPIDI_CH3_Progress_wait(&progress_state);
diff --git a/src/mpid/ch3/src/mpid_recv.c b/src/mpid/ch3/src/mpid_recv.c
index 97b3db1..22199ce 100644
--- a/src/mpid/ch3/src/mpid_recv.c
+++ b/src/mpid/ch3/src/mpid_recv.c
@@ -46,12 +46,12 @@ int MPID_Recv(void * buf, MPI_Aint count, MPI_Datatype datatype, int rank, int t
         MPIR_ERR_SETANDJUMP(mpi_errno,MPIX_ERR_REVOKED,"**revoked");
     }
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     rreq = MPIDI_CH3U_Recvq_FDU_or_AEP(rank, tag, 
 				       comm->recvcontext_id + context_offset,
                                        comm, buf, count, datatype, &found);
     if (rreq == NULL) {
-	MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+	MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 	MPIR_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomemreq");
     }
 
@@ -64,7 +64,7 @@ int MPID_Recv(void * buf, MPI_Aint count, MPI_Datatype datatype, int rank, int t
 
 	/* Release the message queue - we've removed this request from 
 	   the queue already */
-	MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+	MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 	if (MPIDI_Request_get_msg_type(rreq) == MPIDI_REQUEST_EAGER_MSG)
 	{
 	    int recv_pending;
@@ -180,7 +180,7 @@ int MPID_Recv(void * buf, MPI_Aint count, MPI_Datatype datatype, int rank, int t
 	/* We must wait until here to exit the msgqueue critical section
 	   on this request (we needed to set the recv_pending_count
 	   and the datatype pointer) */
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
     }
 
   fn_exit:
diff --git a/src/mpid/ch3/src/mpid_rma.c b/src/mpid/ch3/src/mpid_rma.c
index 65842c5..9242f61 100644
--- a/src/mpid/ch3/src/mpid_rma.c
+++ b/src/mpid/ch3/src/mpid_rma.c
@@ -257,7 +257,7 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
 
     MPIDI_FUNC_ENTER(MPID_STATE_WIN_INIT);
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
     if (initRMAoptions) {
 
         MPIDI_CH3_RMA_Init_sync_pvars();
@@ -265,7 +265,7 @@ static int win_init(MPI_Aint size, int disp_unit, int create_flavor, int model,
 
         initRMAoptions = 0;
     }
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
 
     *win_ptr = (MPID_Win *) MPIU_Handle_obj_alloc(&MPID_Win_mem);
     MPIR_ERR_CHKANDJUMP1(!(*win_ptr), mpi_errno, MPI_ERR_OTHER, "**nomem",
diff --git a/src/mpid/ch3/src/mpidi_isend_self.c b/src/mpid/ch3/src/mpidi_isend_self.c
index 847abfe..1141629 100644
--- a/src/mpid/ch3/src/mpidi_isend_self.c
+++ b/src/mpid/ch3/src/mpidi_isend_self.c
@@ -39,7 +39,7 @@ int MPIDI_Isend_self(const void * buf, MPI_Aint count, MPI_Datatype datatype, in
     match.parts.tag = tag;
     match.parts.context_id = comm->context_id + context_offset;
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.msgq_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 
     rreq = MPIDI_CH3U_Recvq_FDP_or_AEU(&match, &found);
     /* --BEGIN ERROR HANDLING-- */
@@ -85,7 +85,7 @@ int MPIDI_Isend_self(const void * buf, MPI_Aint count, MPI_Datatype datatype, in
 	MPIDI_msg_sz_t data_sz;
 	
         /* we found a posted req, which we now own, so we can release the CS */
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 
 	MPIU_DBG_MSG(CH3_OTHER,VERBOSE,
 		     "found posted receive request; copying data");
@@ -147,7 +147,7 @@ int MPIDI_Isend_self(const void * buf, MPI_Aint count, MPI_Datatype datatype, in
 	MPIDI_Request_set_msg_type(rreq, MPIDI_REQUEST_SELF_MSG);
 
         /* can release now that we've set fields in the unexpected request */
-        MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.msgq_mutex);
+        MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MSGQ_MUTEX);
 
         /* kick the progress engine in case another thread that is performing a
            blocking recv or probe is waiting in the progress engine */
diff --git a/src/mpid/ch3/src/mpidi_pg.c b/src/mpid/ch3/src/mpidi_pg.c
index 3e769f7..b568242 100644
--- a/src/mpid/ch3/src/mpidi_pg.c
+++ b/src/mpid/ch3/src/mpidi_pg.c
@@ -706,13 +706,13 @@ static int getConnInfoKVS( int rank, char *buf, int bufsize, MPIDI_PG_t *pg )
 	MPIR_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**nomem");
     }
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.pmi_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_PMI_MUTEX);
     pmi_errno = PMI_KVS_Get(pg->connData, key, buf, bufsize );
     if (pmi_errno) {
 	MPIDI_PG_CheckForSingleton();
 	pmi_errno = PMI_KVS_Get(pg->connData, key, buf, bufsize );
     }
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.pmi_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_PMI_MUTEX);
     if (pmi_errno) {
 	MPIR_ERR_SETANDJUMP(mpi_errno,MPI_ERR_OTHER,"**pmi_kvs_get");
     }
diff --git a/src/mpid/common/sock/iocp/sock.c b/src/mpid/common/sock/iocp/sock.c
index a9be96f..c232b1d 100644
--- a/src/mpid/common/sock/iocp/sock.c
+++ b/src/mpid/common/sock/iocp/sock.c
@@ -1786,7 +1786,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 	    /* Release the lock so that other threads may make progress while this thread waits for something to do */
 	    MPIU_DBG_MSG(THREAD,TYPICAL,"Exit global critical section");
 	    MPIU_THREAD_CHECK_BEGIN;
-	    MPID_Thread_mutex_unlock(&MPIR_ThreadInfo.global_mutex, &err);
+	    MPID_Thread_mutex_unlock(&MPIR_THREAD_GLOBAL_MUTEX, &err);
 	    MPIU_THREAD_CHECK_END;
 	}
 #       else
@@ -1811,7 +1811,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 		/* Reaquire the lock before processing any of the information returned from GetQueuedCompletionStatus */
 		MPIU_DBG_MSG(THREAD,TYPICAL,"Enter global critical section");
 		MPIU_THREAD_CHECK_BEGIN;
-		MPID_Thread_mutex_lock(&MPIR_ThreadInfo.global_mutex, &err);
+		MPID_Thread_mutex_lock(&MPIR_THREAD_GLOBAL_MUTEX, &err);
 		MPIU_THREAD_CHECK_END;
 	    }
 #           else
@@ -2404,7 +2404,7 @@ int MPIDU_Sock_wait(MPIDU_Sock_set_t set, int timeout, MPIDU_Sock_event_t * out)
 		/* Reaquire the lock before processing any of the information returned from GetQueuedCompletionStatus */
 		MPIU_DBG_MSG(THREAD,TYPICAL,"Enter global critical section");
 		MPIU_THREAD_CHECK_BEGIN;
-		MPID_Thread_mutex_lock(&MPIR_ThreadInfo.global_mutex, &err);
+		MPID_Thread_mutex_lock(&MPIR_THREAD_GLOBAL_MUTEX, &err);
 		MPIU_THREAD_CHECK_END;
 	    }
 #           else
diff --git a/src/mpid/common/sock/poll/sock_wait.i b/src/mpid/common/sock/poll/sock_wait.i
index 6913cbe..adccb3b 100644
--- a/src/mpid/common/sock/poll/sock_wait.i
+++ b/src/mpid/common/sock/poll/sock_wait.i
@@ -156,9 +156,9 @@ int MPIDU_Sock_wait(struct MPIDU_Sock_set * sock_set, int millisecond_timeout,
 		       progress while this thread waits for something to 
 		       do */
 		    MPIU_DBG_MSG(THREAD,TYPICAL,"Exit global critical section (sock_wait)");
-		    /* 		    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.global_mutex);
-				    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex); */
-		    MPID_Thread_mutex_unlock(&MPIR_ThreadInfo.global_mutex, &err);
+		    /* 		    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_GLOBAL_MUTEX);
+				    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX); */
+		    MPID_Thread_mutex_unlock(&MPIR_THREAD_GLOBAL_MUTEX, &err);
 			    
 		    MPIDI_FUNC_ENTER(MPID_STATE_POLL);
 		    n_fds = poll(sock_set->pollfds_active, 
@@ -168,9 +168,9 @@ int MPIDU_Sock_wait(struct MPIDU_Sock_set * sock_set, int millisecond_timeout,
 		    /* Reaquire the lock before processing any of the 
 		       information returned from poll */
 		    MPIU_DBG_MSG(THREAD,TYPICAL,"Enter global critical section (sock_wait)");
-		    /* 		    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
-				    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.global_mutex); */
-		    MPID_Thread_mutex_lock(&MPIR_ThreadInfo.global_mutex, &err);
+		    /* 		    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
+				    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_GLOBAL_MUTEX); */
+		    MPID_Thread_mutex_lock(&MPIR_THREAD_GLOBAL_MUTEX, &err);
 
 		    /*
 		     * Update pollfds array if changes were posted while we 
diff --git a/src/nameserv/pmi/pmi_nameserv.c b/src/nameserv/pmi/pmi_nameserv.c
index 274bb67..b9ef744 100644
--- a/src/nameserv/pmi/pmi_nameserv.c
+++ b/src/nameserv/pmi/pmi_nameserv.c
@@ -51,9 +51,9 @@ int MPID_NS_Publish( MPID_NS_Handle handle, const MPID_Info *info_ptr,
 
 #ifdef USE_PMI2_API
     /* release the global CS for PMI calls */
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     rc = PMI2_Nameserv_publish(service_name, info_ptr, port);
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 #else
     rc = PMI_Publish_name( service_name, port );
 #endif
@@ -78,9 +78,9 @@ int MPID_NS_Lookup( MPID_NS_Handle handle, const MPID_Info *info_ptr,
 
 #ifdef USE_PMI2_API
     /* release the global CS for PMI calls */
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     rc = PMI2_Nameserv_lookup(service_name, info_ptr, port, MPI_MAX_PORT_NAME);
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 #else
     rc = PMI_Lookup_name( service_name, port );
 #endif
@@ -105,9 +105,9 @@ int MPID_NS_Unpublish( MPID_NS_Handle handle, const MPID_Info *info_ptr,
 
 #ifdef USE_PMI2_API
     /* release the global CS for PMI calls */
-    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
     rc = PMI2_Nameserv_unpublish(service_name, info_ptr);
-    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
 #else
     rc = PMI_Unpublish_name( service_name );
 #endif
diff --git a/src/pmi/pmi2/poe/poe2pmi.c b/src/pmi/pmi2/poe/poe2pmi.c
index 2e1adf0..6dd2bb0 100644
--- a/src/pmi/pmi2/poe/poe2pmi.c
+++ b/src/pmi/pmi2/poe/poe2pmi.c
@@ -298,7 +298,7 @@ int _mpi_world_exiting_handler(int world_id)
 /*  struct worldExitReq *req = (struct worldExitReq *)cookie; */
   MPID_Comm *comm = MPIR_Process.comm_world;
 
-  MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
+  MPID_THREAD_CS_ENTER(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
   ref_count = MPIDI_get_refcnt_of_world(world_id);
   TRACE_ERR("_mpi_world_exiting_handler: invoked for world %d exiting ref_count=%d my comm_word_size=%d\n", world_id, ref_count, world_size);
   if(ref_count == 0) {
@@ -322,7 +322,7 @@ int _mpi_world_exiting_handler(int world_id)
 
   TRACE_ERR("_mpi_world_exiting_handler: Out of _mpi_reduce_for_dyntask for exiting world %d reduce_state=%d\n",world_id, reduce_state);
 
-  MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
+  MPID_THREAD_CS_EXIT(GLOBAL, MPIR_THREAD_GLOBAL_MUTEX);
   if(comm->rank == 0) {
     MPL_snprintf(world_id_str, sizeof(world_id_str), "%d", world_id);
     PMI2_Abort(0, world_id_str);
diff --git a/src/util/mem/handlemem.c b/src/util/mem/handlemem.c
index 68f5794..c2c7ccf 100644
--- a/src/util/mem/handlemem.c
+++ b/src/util/mem/handlemem.c
@@ -322,7 +322,7 @@ Input Parameters:
   MPI_Requests) and should not call any other routines in the common
   case.
 
-  Threading: The 'MPID_THREAD_CS_ENTER/EXIT(POBJ, MPIR_ThreadInfo.handle_mutex)' enables both 
+  Threading: The 'MPID_THREAD_CS_ENTER/EXIT(POBJ, MPIR_THREAD_HANDLE_MUTEX)' enables both 
   finer-grain
   locking with a single global mutex and with a mutex specific for handles.
 
@@ -334,9 +334,9 @@ Input Parameters:
 void *MPIU_Handle_obj_alloc(MPIU_Object_alloc_t *objmem)
 {
     void *ret;
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.handle_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_HANDLE_MUTEX);
     ret = MPIU_Handle_obj_alloc_unsafe(objmem);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.handle_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_HANDLE_MUTEX);
     return ret;
 }
 
@@ -459,7 +459,7 @@ void MPIU_Handle_obj_free( MPIU_Object_alloc_t *objmem, void *object )
 {
     MPIU_Handle_common *obj = (MPIU_Handle_common *)object;
 
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.handle_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_HANDLE_MUTEX);
 
     MPIU_DBG_MSG_FMT(HANDLE,TYPICAL,(MPIU_DBG_FDEST,
                                      "Freeing object ptr %p (0x%08x kind=%s) refcount=%d",
@@ -502,7 +502,7 @@ void MPIU_Handle_obj_free( MPIU_Object_alloc_t *objmem, void *object )
 
     obj->next	        = objmem->avail;
     objmem->avail	= obj;
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.handle_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_HANDLE_MUTEX);
 }
 
 /* 
diff --git a/src/util/mem/trmem.c b/src/util/mem/trmem.c
index bd491f8..2b8769c 100644
--- a/src/util/mem/trmem.c
+++ b/src/util/mem/trmem.c
@@ -17,95 +17,95 @@ void MPIU_trinit(int rank)
 
 void MPIU_trdump(FILE *fp, int minid)
 {
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     MPL_trdump(fp, minid);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
 }
 
 void *MPIU_trmalloc(size_t a, int lineno, const char fname[])
 {
     void *retval;
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     retval = MPL_trmalloc(a, lineno, fname);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     return retval;
 }
 
 void MPIU_trfree(void *a_ptr, int line, const char fname[])
 {
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     MPL_trfree(a_ptr, line, fname);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
 }
 
 int MPIU_trvalid(const char str[])
 {
     int retval;
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     retval = MPL_trvalid(str);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     return retval;
 }
 
 void MPIU_trspace(size_t *space, size_t *fr)
 {
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     MPL_trspace(space, fr);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
 }
 
 void MPIU_trid(int id)
 {
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     MPL_trid(id);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
 }
 
 void MPIU_trlevel(int level)
 {
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     MPL_trlevel(level);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
 }
 
 void MPIU_trDebugLevel(int level)
 {
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     MPL_trDebugLevel(level);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
 }
 
 void *MPIU_trcalloc(size_t nelem, size_t elsize, int lineno, const char fname[])
 {
     void *retval;
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     retval = MPL_trcalloc(nelem, elsize, lineno, fname);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     return retval;
 }
 
 void *MPIU_trrealloc(void *p, size_t size, int lineno, const char fname[])
 {
     void *retval;
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     retval = MPL_trrealloc(p, size, lineno, fname);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     return retval;
 }
 
 void *MPIU_trstrdup(const char *str, int lineno, const char fname[])
 {
     void *retval;
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     retval = MPL_trstrdup(str, lineno, fname);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     return retval;
 }
 
 void MPIU_TrSetMaxMem(size_t size)
 {
-    MPID_THREAD_CS_ENTER(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_ENTER(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
     MPL_TrSetMaxMem(size);
-    MPID_THREAD_CS_EXIT(POBJ, MPIR_ThreadInfo.memalloc_mutex);
+    MPID_THREAD_CS_EXIT(POBJ, MPIR_THREAD_MEMALLOC_MUTEX);
 }
 
diff --git a/src/util/thread/mpiu_thread.h b/src/util/thread/mpiu_thread.h
index 4a7641f..e005619 100644
--- a/src/util/thread/mpiu_thread.h
+++ b/src/util/thread/mpiu_thread.h
@@ -149,6 +149,14 @@ typedef struct MPICH_ThreadInfo_t {
 } MPICH_ThreadInfo_t;
 extern MPICH_ThreadInfo_t MPIR_ThreadInfo;
 
+#define MPIR_THREAD_GLOBAL_MUTEX      MPIR_ThreadInfo.global_mutex
+#define MPIR_THREAD_HANDLE_MUTEX      MPIR_ThreadInfo.handle_mutex
+#define MPIR_THREAD_MSGQ_MUTEX        MPIR_ThreadInfo.msgq_mutex
+#define MPIR_THREAD_COMPLETION_MUTEX  MPIR_ThreadInfo.completion_mutex
+#define MPIR_THREAD_CTX_MUTEX         MPIR_ThreadInfo.ctx_mutex
+#define MPIR_THREAD_PMI_MUTEX         MPIR_ThreadInfo.pmi_mutex
+#define MPIR_THREAD_MEMALLOC_MUTEX    MPIR_ThreadInfo.memalloc_mutex
+
 /* ------------------------------------------------------------------------- */
 /* thread-local storage macros */
 /* moved here from mpiimpl.h because they logically belong here */

http://git.mpich.org/mpich.git/commitdiff/964b32d0180840e868cc10b28180c78a3e10d87f

commit 964b32d0180840e868cc10b28180c78a3e10d87f
Author: Pavan Balaji <balaji at anl.gov>
Date:   Fri Aug 14 17:31:29 2015 -0500

    Remove unused CH3-specific CS functionality.
    
    No reviewer.

diff --git a/src/mpid/ch3/include/mpidimpl.h b/src/mpid/ch3/include/mpidimpl.h
index 10a14b8..55631dc 100644
--- a/src/mpid/ch3/include/mpidimpl.h
+++ b/src/mpid/ch3/include/mpidimpl.h
@@ -1875,32 +1875,6 @@ int MPIDI_CH3_ReqHandler_FOPSendComplete( MPIDI_VC_t *, MPID_Request *,
 /* RMA operation request handler */
 int MPIDI_CH3_Req_handler_rma_op_complete(MPID_Request *);
 
-/* Thread Support */
-#ifdef MPICH_IS_THREADED
-#if MPICH_THREAD_GRANULARITY == MPIR_THREAD_GRANULARITY_GLOBAL
-/* There is a single, global lock, held for the duration of an MPI call */
-#define MPIU_THREAD_CS_ENTER_LMT(_context)
-#define MPIU_THREAD_CS_EXIT_LMT(_context)
-
-#elif MPICH_THREAD_GRANULARITY == MPIR_THREAD_GRANULARITY_PER_OBJECT
-
-/* MT FIXME making LMT into MPIDCOMM for now because of overwhelming deadlock
- * issues */
-#define MPIU_THREAD_CS_ENTER_LMT(context_) MPID_THREAD_CS_ENTER_MPIDCOMM(context_)
-#define MPIU_THREAD_CS_EXIT_LMT(context_)  MPID_THREAD_CS_EXIT_MPIDCOMM(context_)
-
-#elif MPICH_THREAD_GRANULARITY == MPIR_THREAD_GRANULARITY_SINGLE
-/* No thread support, make all operations a no-op */
-/* FIXME incomplete? or already handled by the upper level? */
-/* FIXME does it make sense to have (MPICH_IS_THREADED && _GRANULARITY==_SINGLE) ? */
-
-#else
-#error Unrecognized thread granularity
-#endif
-#else
-
-#endif /* MPICH_IS_THREADED */
-
 #define MPIDI_CH3_GET_EAGER_THRESHOLD(eager_threshold_p, comm, vc)  \
     do {                                                            \
         if ((comm)->dev.eager_max_msg_sz != -1)                     \

http://git.mpich.org/mpich.git/commitdiff/94c2de448a2e9a598787d41cd948335eb756778a

commit 94c2de448a2e9a598787d41cd948335eb756778a
Author: Halim Amer <aamer at anl.gov>
Date:   Fri Aug 14 15:18:41 2015 -0500

    Refactor USE_xx to MPIU_xx in mpiu_timer*
    
    Signed-off-by: Pavan Balaji <balaji at anl.gov>

diff --git a/configure.ac b/configure.ac
index f5953f0..a175928 100644
--- a/configure.ac
+++ b/configure.ac
@@ -5019,7 +5019,7 @@ esac
 # Convert timer type to upper case
 timer_type=`echo $timer_type | \
     tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'`
-MPICH_TIMER_KIND=USE_$timer_type
+MPICH_TIMER_KIND=MPIU_$timer_type
 AC_SUBST(MPICH_TIMER_KIND)
 # ----------------------------------------------------------------------------
 # End of code for timer support (except for ac_ OUTPUT)
diff --git a/src/util/timers/mpiu_timer.c b/src/util/timers/mpiu_timer.c
index bebd005..ff4c5fb 100644
--- a/src/util/timers/mpiu_timer.c
+++ b/src/util/timers/mpiu_timer.c
@@ -38,7 +38,7 @@ static void init_wtick(void)
     }
 }
 
-#if MPICH_TIMER_KIND == USE_GETHRTIME
+#if MPICH_TIMER_KIND == MPIU_GETHRTIME
 /*
  * MPIU_Time_t is hrtime_t, which under Solaris is defined as a 64bit
  * longlong_t .  However, the Solaris header files will define
@@ -86,7 +86,7 @@ int MPIU_Wtime_init(void)
     return 0;
 }
 
-#elif MPICH_TIMER_KIND == USE_CLOCK_GETTIME
+#elif MPICH_TIMER_KIND == MPIU_CLOCK_GETTIME
 void MPIU_Wtime(MPIU_Time_t * timeval)
 {
     /* POSIX timer (14.2.1, page 311) */
@@ -140,7 +140,7 @@ int MPIU_Wtime_init(void)
 }
 
 
-#elif MPICH_TIMER_KIND == USE_GETTIMEOFDAY
+#elif MPICH_TIMER_KIND == MPIU_GETTIMEOFDAY
 #ifdef HAVE_SYS_TIME_H
 #include <sys/time.h>
 #endif
@@ -188,7 +188,7 @@ int MPIU_Wtime_init(void)
 }
 
 
-#elif MPICH_TIMER_KIND == USE_LINUX86_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_LINUX86_CYCLE
 #include <sys/time.h>
 double MPIU_Seconds_per_tick = 0.0;
 double MPIU_Wtick(void)
@@ -240,7 +240,7 @@ double MPIU_Wtick(void)
 }
 
 
-#elif MPICH_TIMER_KIND == USE_GCC_IA64_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_GCC_IA64_CYCLE
 #include <sys/time.h>
 double MPIU_Seconds_per_tick = 0.0;
 double MPIU_Wtick(void)
@@ -286,12 +286,12 @@ void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
     *t3 += (*t2 - *t1);
 }
 
-#elif MPICH_TIMER_KIND == USE_LINUXALPHA_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_LINUXALPHA_CYCLE
 /* FIXME: This should have been fixed in the configure, rather than as a
    make-time error message */
 #error "LinuxAlpha cycle counter not supported"
 
-#elif (MPICH_TIMER_KIND == USE_WIN86_CYCLE) || (MPICH_TIMER_KIND == USE_WIN64_CYCLE)
+#elif (MPICH_TIMER_KIND == MPIU_WIN86_CYCLE) || (MPICH_TIMER_KIND == MPIU_WIN64_CYCLE)
 double MPIU_Seconds_per_tick = 0.0;
 double MPIU_Wtick(void)
 {
@@ -337,7 +337,7 @@ int MPIU_Wtime_init(void)
      */
     return 0;
 }
-#elif MPICH_TIMER_KIND == USE_QUERYPERFORMANCECOUNTER
+#elif MPICH_TIMER_KIND == MPIU_QUERYPERFORMANCECOUNTER
 double MPIU_Seconds_per_tick = 0.0;     /* High performance counter frequency */
 int MPIU_Wtime_init(void)
 {
@@ -370,7 +370,7 @@ void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
 }
 
 
-#elif MPICH_TIMER_KIND == USE_MACH_ABSOLUTE_TIME
+#elif MPICH_TIMER_KIND == MPIU_MACH_ABSOLUTE_TIME
 static double MPIR_Wtime_mult;
 
 int MPIU_Wtime_init(void)
diff --git a/src/util/timers/mpiu_timer.h.in b/src/util/timers/mpiu_timer.h.in
index ae6d1b4..713543b 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/util/timers/mpiu_timer.h.in
@@ -19,41 +19,41 @@
  * is needed only to build the function versions of the timers.
  */
 /* Include the appropriate files */
-#define USE_GETHRTIME               1
-#define USE_CLOCK_GETTIME           2
-#define USE_GETTIMEOFDAY            3
-#define USE_LINUX86_CYCLE           4
-#define USE_LINUXALPHA_CYCLE        5
-#define USE_QUERYPERFORMANCECOUNTER 6
-#define USE_WIN86_CYCLE             7
-#define USE_GCC_IA64_CYCLE          8
-/* The value "USE_DEVICE" means that the ADI device provides the timer */
-#define USE_DEVICE                  9
-#define USE_WIN64_CYCLE             10
-#define USE_MACH_ABSOLUTE_TIME      11
+#define MPIU_GETHRTIME               1
+#define MPIU_CLOCK_GETTIME           2
+#define MPIU_GETTIMEOFDAY            3
+#define MPIU_LINUX86_CYCLE           4
+#define MPIU_LINUXALPHA_CYCLE        5
+#define MPIU_QUERYPERFORMANCECOUNTER 6
+#define MPIU_WIN86_CYCLE             7
+#define MPIU_GCC_IA64_CYCLE          8
+/* The value "MPIU_DEVICE" means that the ADI device provides the timer */
+#define MPIU_DEVICE                  9
+#define MPIU_WIN64_CYCLE             10
+#define MPIU_MACH_ABSOLUTE_TIME      11
 #define MPICH_TIMER_KIND @MPICH_TIMER_KIND@
 
-#if MPICH_TIMER_KIND == USE_GETHRTIME
+#if MPICH_TIMER_KIND == MPIU_GETHRTIME
 #include <sys/time.h>
-#elif MPICH_TIMER_KIND == USE_CLOCK_GETTIME
+#elif MPICH_TIMER_KIND == MPIU_CLOCK_GETTIME
 #include <time.h>
 #ifdef NEEDS_SYS_TIME_H
 /* Some OS'es mistakenly require sys/time.h to get the definition of
    CLOCK_REALTIME (POSIX requires the definition to be in time.h) */
 #include <sys/time.h>
 #endif
-#elif MPICH_TIMER_KIND == USE_GETTIMEOFDAY
+#elif MPICH_TIMER_KIND == MPIU_GETTIMEOFDAY
 #include <sys/types.h>
 #include <sys/time.h>
-#elif MPICH_TIMER_KIND == USE_LINUX86_CYCLE
-#elif MPICH_TIMER_KIND == USE_GCC_IA64_CYCLE
-#elif MPICH_TIMER_KIND == USE_LINUXALPHA_CYCLE
-#elif MPICH_TIMER_KIND == USE_QUERYPERFORMANCECOUNTER
+#elif MPICH_TIMER_KIND == MPIU_LINUX86_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_GCC_IA64_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_LINUXALPHA_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_QUERYPERFORMANCECOUNTER
 #include <winsock2.h>
 #include <windows.h>
-#elif MPICH_TIMER_KIND == USE_MACH_ABSOLUTE_TIME
+#elif MPICH_TIMER_KIND == MPIU_MACH_ABSOLUTE_TIME
 #include <mach/mach_time.h>
-#elif MPICH_TIMER_KIND == USE_WIN86_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_WIN86_CYCLE
 #include <winsock2.h>
 #include <windows.h>
 #endif
@@ -227,16 +227,16 @@ int MPIU_Wtime_init(void);
 /* The timer kind is set using AC_SUBST in the MPICH configure */
 #define MPICH_TIMER_KIND @MPICH_TIMER_KIND@
 
-#if MPICH_TIMER_KIND == USE_GETHRTIME
+#if MPICH_TIMER_KIND == MPIU_GETHRTIME
 #define MPIUM_Wtime_todouble MPIU_Wtime_todouble
 
-#elif MPICH_TIMER_KIND == USE_CLOCK_GETTIME
+#elif MPICH_TIMER_KIND == MPIU_CLOCK_GETTIME
 #define MPIUM_Wtime_todouble MPIU_Wtime_todouble
 
-#elif MPICH_TIMER_KIND == USE_GETTIMEOFDAY
+#elif MPICH_TIMER_KIND == MPIU_GETTIMEOFDAY
 #define MPIUM_Wtime_todouble MPIU_Wtime_todouble
 
-#elif MPICH_TIMER_KIND == USE_LINUX86_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_LINUX86_CYCLE
 /* The rdtsc instruction is not a "serializing" instruction, so the
    processor is free to reorder it.  In order to get more accurate
    timing numbers with rdtsc, we need to put a serializing
@@ -268,7 +268,7 @@ int MPIU_Wtime_init(void);
 extern double MPIU_Seconds_per_tick;
 #define MPIUM_Wtime_todouble(t, d) *d = (double)*t * MPIU_Seconds_per_tick
 
-#elif MPICH_TIMER_KIND == USE_GCC_IA64_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_GCC_IA64_CYCLE
 #ifdef __INTEL_COMPILER
 #include "ia64regs.h"
 #define MPIU_Wtime(var_ptr) { MPIU_Time_t t_val;\
@@ -280,16 +280,16 @@ extern double MPIU_Seconds_per_tick;
 extern double MPIU_Seconds_per_tick;
 #define MPIUM_Wtime_todouble(t, d) *d = (double)*t * MPIU_Seconds_per_tick
 
-#elif MPICH_TIMER_KIND == USE_LINUXALPHA_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_LINUXALPHA_CYCLE
 #define MPIUM_Wtime_todouble MPIU_Wtime_todouble
 
-#elif MPICH_TIMER_KIND == USE_QUERYPERFORMANCECOUNTER
+#elif MPICH_TIMER_KIND == MPIU_QUERYPERFORMANCECOUNTER
 #define MPIU_Wtime(var) QueryPerformanceCounter(var)
 extern double MPIU_Seconds_per_tick;
 #define MPIUM_Wtime_todouble( t, d ) \
   *d = (double)t->QuadPart * MPIU_Seconds_per_tick /* convert to seconds */
 
-#elif MPICH_TIMER_KIND == USE_WIN86_CYCLE
+#elif MPICH_TIMER_KIND == MPIU_WIN86_CYCLE
 #define MPIU_Wtime(var_ptr) \
 { \
     register int *f1 = (int*)var_ptr; \
@@ -303,7 +303,7 @@ extern double MPIU_Seconds_per_tick;
 #define MPIUM_Wtime_todouble(t, d) *d = (double)(__int64)*t * MPIU_Seconds_per_tick
 #define MPIUM_Wtime_diff(t1,t2,diff) *diff = (double)((__int64)( *t2 - *t1 )) * MPIU_Seconds_per_tick
 
-#elif MPICH_TIMER_KIND == USE_MACH_ABSOLUTE_TIME
+#elif MPICH_TIMER_KIND == MPIU_MACH_ABSOLUTE_TIME
 #define MPIUM_Wtime_todouble MPIU_Wtime_todouble
 
 #endif

http://git.mpich.org/mpich.git/commitdiff/8c1db8c508ae2cba9ab4ef53ce5018a2e61b8266

commit 8c1db8c508ae2cba9ab4ef53ce5018a2e61b8266
Author: Pavan Balaji <balaji at anl.gov>
Date:   Fri Aug 14 16:47:18 2015 -0500

    Remove useless redefinitions of MPIU_Wtime_init.
    
    We both define the function MPIU_Wtime_init and macro it to 0, which
    is weird.  This patch removes the macro.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/timers/mpiu_timer.h.in b/src/util/timers/mpiu_timer.h.in
index a0ad428..ae6d1b4 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/util/timers/mpiu_timer.h.in
@@ -228,7 +228,6 @@ int MPIU_Wtime_init(void);
 #define MPICH_TIMER_KIND @MPICH_TIMER_KIND@
 
 #if MPICH_TIMER_KIND == USE_GETHRTIME
-#define MPIU_Wtime_init() 0
 #define MPIUM_Wtime_todouble MPIU_Wtime_todouble
 
 #elif MPICH_TIMER_KIND == USE_CLOCK_GETTIME
@@ -282,7 +281,6 @@ extern double MPIU_Seconds_per_tick;
 #define MPIUM_Wtime_todouble(t, d) *d = (double)*t * MPIU_Seconds_per_tick
 
 #elif MPICH_TIMER_KIND == USE_LINUXALPHA_CYCLE
-#define MPIU_Wtime_init() 0
 #define MPIUM_Wtime_todouble MPIU_Wtime_todouble
 
 #elif MPICH_TIMER_KIND == USE_QUERYPERFORMANCECOUNTER

http://git.mpich.org/mpich.git/commitdiff/45bfb114d45fb5dbeeeaa80e4d975ff0b8a267a3

commit 45bfb114d45fb5dbeeeaa80e4d975ff0b8a267a3
Author: Pavan Balaji <balaji at anl.gov>
Date:   Fri Aug 14 16:03:54 2015 -0500

    White space cleanup.
    
    No reviewer.

diff --git a/src/util/thread/mpiu_thread.c b/src/util/thread/mpiu_thread.c
index 8626ab4..c132d49 100644
--- a/src/util/thread/mpiu_thread.c
+++ b/src/util/thread/mpiu_thread.c
@@ -15,7 +15,7 @@ MPICH_PerThread_t MPIU_Thread = { 0 };
 
 MPIU_TLS_SPECIFIER MPICH_PerThread_t MPIU_Thread = { 0 };
 
-#else  /* defined(MPICH_IS_THREADED) && !defined(MPIU_TLS_SPECIFIER) */
+#else /* defined(MPICH_IS_THREADED) && !defined(MPIU_TLS_SPECIFIER) */
 
 /* If we may be single threaded, we need a preallocated version to use
  * if we are single threaded case */
@@ -24,10 +24,10 @@ MPICH_PerThread_t MPIU_ThreadSingle = { 0 };
 /* This routine is called when a thread exits; it is passed the value
  * associated with the key.  In our case, this is simply storage
  * allocated with MPIU_Calloc */
-void MPIUI_Cleanup_tls( void *a )
+void MPIUI_Cleanup_tls(void *a)
 {
     if (a)
-	MPIU_Free( a );
+        MPIU_Free(a);
 }
 
 #endif
diff --git a/src/util/thread/mpiu_thread_multiple.h b/src/util/thread/mpiu_thread_multiple.h
index 26cb19c..20ec810 100644
--- a/src/util/thread/mpiu_thread_multiple.h
+++ b/src/util/thread/mpiu_thread_multiple.h
@@ -39,25 +39,25 @@
 #define MPIU_THREAD_CS_ENTER_LOCKNAME(name_,mutex_)                     \
     do {                                                                \
         MPIU_DBG_MSG_S(THREAD,VERBOSE,"attempting to ENTER lockname=%s", #name_); \
-        MPIU_Thread_CS_enter_lockname_impl_(#name_, &mutex_); \
+        MPIU_Thread_CS_enter_lockname_impl_(#name_, &mutex_);           \
     } while (0)
 
 #define MPIU_THREAD_CS_EXIT_LOCKNAME(name_,mutex_)                      \
     do {                                                                \
         MPIU_DBG_MSG_S(THREAD,VERBOSE,"attempting to EXIT lockname=%s", #name_); \
-        MPIU_Thread_CS_exit_lockname_impl_(#name_, &mutex_); \
+        MPIU_Thread_CS_exit_lockname_impl_(#name_, &mutex_);            \
     } while (0)
 
 #define MPIU_THREAD_CS_YIELD_LOCKNAME(name_,mutex_)                     \
     do {                                                                \
         MPIU_DBG_MSG_S(THREAD,VERBOSE,"attempting to YIELD lockname=%s", #name_); \
-        MPIU_Thread_CS_yield_lockname_impl_(#name_, &mutex_); \
+        MPIU_Thread_CS_yield_lockname_impl_(#name_, &mutex_);           \
     } while (0)
 
 
 enum MPIU_Nest_mutexes {
     MPIU_NEST_GLOBAL = 0,
-    MPIU_NEST_POBJ,   /* Nesting does not really make sense for POBJ */
+    MPIU_NEST_POBJ,     /* Nesting does not really make sense for POBJ */
     MPIU_NEST_NUM_MUTEXES
 };
 
diff --git a/src/util/thread/mpiu_thread_pobj.h b/src/util/thread/mpiu_thread_pobj.h
index fb9e187..40b287c 100644
--- a/src/util/thread/mpiu_thread_pobj.h
+++ b/src/util/thread/mpiu_thread_pobj.h
@@ -149,23 +149,23 @@ static MPL_DBG_INLINE_KEYWORD int MPIU_cc_is_complete(MPIU_cc_t * cc_ptr)
 }
 
 /* incomplete_==TRUE iff the cc > 0 after the decr */
-#define MPIU_cc_decr(cc_ptr_, incomplete_)                                  \
-    do {                                                                    \
-        OPA_write_barrier();                                                \
-        MPL_VG_ANNOTATE_HAPPENS_BEFORE(cc_ptr_);                            \
-        *(incomplete_) = !OPA_decr_and_test_int(cc_ptr_);                   \
-        /* TODO check if this HA is actually necessary */                   \
-        if (!*(incomplete_)) {                                              \
-            MPL_VG_ANNOTATE_HAPPENS_AFTER(cc_ptr_);                         \
-        }                                                                   \
+#define MPIU_cc_decr(cc_ptr_, incomplete_)                      \
+    do {                                                        \
+        OPA_write_barrier();                                    \
+        MPL_VG_ANNOTATE_HAPPENS_BEFORE(cc_ptr_);                \
+        *(incomplete_) = !OPA_decr_and_test_int(cc_ptr_);       \
+        /* TODO check if this HA is actually necessary */       \
+        if (!*(incomplete_)) {                                  \
+            MPL_VG_ANNOTATE_HAPPENS_AFTER(cc_ptr_);             \
+        }                                                       \
     } while (0)
 
 /* MT FIXME does this need a HB/HA annotation?  This macro is only used for
  * cancel_send right now. */
 /* was_incomplete_==TRUE iff the cc==0 before the decr */
-#define MPIU_cc_incr(cc_ptr_, was_incomplete_)                              \
-    do {                                                                    \
-        *(was_incomplete_) = OPA_fetch_and_incr_int(cc_ptr_);               \
+#define MPIU_cc_incr(cc_ptr_, was_incomplete_)                  \
+    do {                                                        \
+        *(was_incomplete_) = OPA_fetch_and_incr_int(cc_ptr_);   \
     } while (0)
 
 #define MPIU_cc_get(cc_) OPA_load_int(&(cc_))
@@ -184,18 +184,18 @@ static MPL_DBG_INLINE_KEYWORD int MPIU_cc_is_complete(MPIU_cc_t * cc_ptr)
 /* Ideally _GLOBAL would use this too, but we don't want to count on OPA
  * availability in _GLOBAL mode.  Instead the GLOBAL critical section should be
  * used. */
-#define MPIU_OBJ_PUBLISH_HANDLE(hnd_lval_, handle_)                                 \
-    do {                                                                            \
+#define MPIU_OBJ_PUBLISH_HANDLE(hnd_lval_, handle_)                     \
+    do {                                                                \
         if (MPIR_ThreadInfo.isThreaded) {                               \
             /* wmb ensures all read-only object field values are seen before the */ \
-            /* handle value is seen at the application level */                     \
-            OPA_write_barrier();                                                    \
-            /* volatile ensures lval is not speculatively read or written */        \
-            *(volatile int *)&(hnd_lval_) = (handle_);                              \
-        }                                                                           \
-        else {                                                                      \
-            (hnd_lval_) = (handle_);                                                \
-        }                                                                           \
+            /* handle value is seen at the application level */         \
+            OPA_write_barrier();                                        \
+            /* volatile ensures lval is not speculatively read or written */ \
+            *(volatile int *)&(hnd_lval_) = (handle_);                  \
+        }                                                               \
+        else {                                                          \
+            (hnd_lval_) = (handle_);                                    \
+        }                                                               \
     } while (0)
 
 #endif /* !defined(MPIU_THREAD_POBJ_H_INCLUDED) */
diff --git a/src/util/thread/mpiu_thread_posix_funcs.h b/src/util/thread/mpiu_thread_posix_funcs.h
index 1ffde48..b82e7d3 100644
--- a/src/util/thread/mpiu_thread_posix_funcs.h
+++ b/src/util/thread/mpiu_thread_posix_funcs.h
@@ -11,13 +11,13 @@
 #ifndef MPIU_THREAD_POSIX_FUNCS_H_INCLUDED
 #define MPIU_THREAD_POSIX_FUNCS_H_INCLUDED
 
-#include "mpiu_process_wrappers.h" /* for MPIU_PW_Sched_yield */
+#include "mpiu_process_wrappers.h"      /* for MPIU_PW_Sched_yield */
 
-/* 
-   One of PTHREAD_MUTEX_RECURSIVE_NP and PTHREAD_MUTEX_RECURSIVE seem to be 
-   present in different versions.  For example, Mac OS X 10.4 had 
+/*
+   One of PTHREAD_MUTEX_RECURSIVE_NP and PTHREAD_MUTEX_RECURSIVE seem to be
+   present in different versions.  For example, Mac OS X 10.4 had
    PTHREAD_MUTEX_RECURSIVE_NP but Mac OS X 10.5 does not; instead it has
-   PTHREAD_MUTEX_RECURSIVE 
+   PTHREAD_MUTEX_RECURSIVE
 */
 #if defined(HAVE_PTHREAD_MUTEX_RECURSIVE_NP)
 #define PTHREAD_MUTEX_RECURSIVE_VALUE PTHREAD_MUTEX_RECURSIVE_NP
@@ -28,25 +28,25 @@
 #endif /* pthread mutex recursive value */
 
 #if defined(NEEDS_PTHREAD_MUTEXATTR_SETTYPE_DECL)
-int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind);
+int pthread_mutexattr_settype(pthread_mutexattr_t * attr, int kind);
 #endif /* NEEDS_PTHREAD_MUTEXATTR_SETTYPE_DECL */
 
 /* MPIU_Thread_create() defined in mpiu_thread.c */
 
 #define MPIU_Thread_exit()			\
-do {                                               \
-    pthread_exit(NULL);				\
-} while (0)
+    do {                                        \
+        pthread_exit(NULL);                     \
+    } while (0)
 
 #define MPIU_Thread_self(id_)			\
-do {                                               \
-    *(id_) = pthread_self();			\
-} while (0)
+    do {                                        \
+        *(id_) = pthread_self();                \
+    } while (0)
 
-#define MPIU_Thread_same(id1_, id2_, same_)			\
-do {                                                               \
-    *(same_) = pthread_equal(*(id1_), *(id2_)) ? TRUE : FALSE;	\
-} while (0)
+#define MPIU_Thread_same(id1_, id2_, same_)                             \
+    do {                                                                \
+        *(same_) = pthread_equal(*(id1_), *(id2_)) ? TRUE : FALSE;	\
+    } while (0)
 
 #define MPIU_Thread_yield(mutex_ptr_)                                   \
     do {                                                                \
@@ -73,211 +73,229 @@ do {                                                               \
 
 /* FIXME: using constant initializer if available */
 #if !defined(MPICH_DEBUG_MUTEX) || !defined(PTHREAD_MUTEX_ERRORCHECK_VALUE)
-#define MPIU_Thread_mutex_create(mutex_ptr_, err_ptr_)                   \
-do {                                                                       \
-    int err__;                                                          \
+
+#define MPIU_Thread_mutex_create(mutex_ptr_, err_ptr_)                  \
+    do {                                                                \
+        int err__;                                                      \
                                                                         \
-    OPA_store_int(&(mutex_ptr_)->num_queued_threads,0);                  \
-    err__ = pthread_mutex_init(&(mutex_ptr_)->mutex, NULL);             \
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */              \
-    *(int *)(err_ptr_) = err__;                                         \
-    MPIU_DBG_MSG_P(THREAD,TYPICAL,"Created MPIU_Thread_mutex %p", (mutex_ptr_));    \
-} while (0)
-#else /* MPICH_DEBUG_MUTEX */
-#define MPIU_Thread_mutex_create(mutex_ptr_, err_ptr_)                   \
-do {                                                                       \
-    int err__;                                                          \
-    OPA_store_int(&(mutex_ptr_)->num_queued_threads,0);                  \
-    pthread_mutexattr_t attr__;                                         \
+        OPA_store_int(&(mutex_ptr_)->num_queued_threads,0);             \
+        err__ = pthread_mutex_init(&(mutex_ptr_)->mutex, NULL);         \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+        *(int *)(err_ptr_) = err__;                                     \
+        MPIU_DBG_MSG_P(THREAD,TYPICAL,"Created MPIU_Thread_mutex %p", (mutex_ptr_)); \
+    } while (0)
+
+#else /* defined(MPICH_DEBUG_MUTEX) && defined(PTHREAD_MUTEX_ERRORCHECK_VALUE) */
+
+#define MPIU_Thread_mutex_create(mutex_ptr_, err_ptr_)                  \
+    do {                                                                \
+        int err__;                                                      \
+        OPA_store_int(&(mutex_ptr_)->num_queued_threads,0);             \
+        pthread_mutexattr_t attr__;                                     \
                                                                         \
-    /* FIXME this used to be PTHREAD_MUTEX_ERRORCHECK_NP, but we had to change
-       it for the thread granularity work when we needed recursive mutexes.  We
-       should go through this code and see if there's any good way to implement
-       error checked versions with the recursive mutexes. */ \
-    pthread_mutexattr_init(&attr__);                                    \
-    pthread_mutexattr_settype(&attr__, PTHREAD_MUTEX_ERRORCHECK_VALUE); \
-    err__ = pthread_mutex_init(&(mutex_ptr_)->mutex, &attr__);          \
-    if (err__)                                                          \
-        MPL_internal_sys_error_printf("pthread_mutex_init", err__,     \
-                                       "    %s:%d\n", __FILE__, __LINE__);\
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */                  \
-    *(int *)(err_ptr_) = err__;                                             \
-    MPIU_DBG_MSG_P(THREAD,TYPICAL,"Created MPIU_Thread_mutex %p", (mutex_ptr_));    \
-} while (0)
-#endif
-
-#define MPIU_Thread_mutex_destroy(mutex_ptr_, err_ptr_)		\
-do {                                                               \
-    int err__;							\
-								\
-    MPIU_DBG_MSG_P(THREAD,TYPICAL,"About to destroy MPIU_Thread_mutex %p", (mutex_ptr_));    \
-    err__ = pthread_mutex_destroy(&(mutex_ptr_)->mutex);                \
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */	\
-    *(int *)(err_ptr_) = err__;                                 \
-} while (0)
-
-#ifndef MPICH_DEBUG_MUTEX
-#define MPIU_Thread_mutex_lock(mutex_ptr_, err_ptr_)             \
-do {                                                               \
-    int err__;                                                  \
-    MPIU_DBG_MSG_P(THREAD,VERBOSE,"enter MPIU_Thread_mutex_lock %p", (mutex_ptr_));      \
-    OPA_incr_int(&(mutex_ptr_)->num_queued_threads);                  \
-    err__ = pthread_mutex_lock(&(mutex_ptr_)->mutex);                   \
-    OPA_decr_int(&(mutex_ptr_)->num_queued_threads);                 \
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */      \
-    *(int *)(err_ptr_) = err__;                                 \
-    MPIU_DBG_MSG_P(THREAD,VERBOSE,"exit MPIU_Thread_mutex_lock %p", (mutex_ptr_));      \
-} while (0)
+        /* FIXME this used to be PTHREAD_MUTEX_ERRORCHECK_NP, but we    \
+         * had to change it for the thread granularity work when we     \
+         * needed recursive mutexes.  We should go through this code    \
+         * and see if there's any good way to implement error checked   \
+         * versions with the recursive mutexes. */                      \
+        pthread_mutexattr_init(&attr__);                                \
+        pthread_mutexattr_settype(&attr__, PTHREAD_MUTEX_ERRORCHECK_VALUE); \
+        err__ = pthread_mutex_init(&(mutex_ptr_)->mutex, &attr__);      \
+        if (err__)                                                      \
+            MPL_internal_sys_error_printf("pthread_mutex_init", err__,  \
+                                          "    %s:%d\n", __FILE__, __LINE__); \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+        *(int *)(err_ptr_) = err__;                                     \
+        MPIU_DBG_MSG_P(THREAD,TYPICAL,"Created MPIU_Thread_mutex %p", (mutex_ptr_)); \
+    } while (0)
+
+#endif /* defined(MPICH_DEBUG_MUTEX) && defined(PTHREAD_MUTEX_ERRORCHECK_VALUE) */
+
+#define MPIU_Thread_mutex_destroy(mutex_ptr_, err_ptr_)                 \
+    do {                                                                \
+        int err__;							\
+                                                                        \
+        MPIU_DBG_MSG_P(THREAD,TYPICAL,"About to destroy MPIU_Thread_mutex %p", (mutex_ptr_)); \
+        err__ = pthread_mutex_destroy(&(mutex_ptr_)->mutex);            \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+        *(int *)(err_ptr_) = err__;                                     \
+    } while (0)
+
+
+#if !defined(MPICH_DEBUG_MUTEX)
+
+#define MPIU_Thread_mutex_lock(mutex_ptr_, err_ptr_)                    \
+    do {                                                                \
+        int err__;                                                      \
+        MPIU_DBG_MSG_P(THREAD,VERBOSE,"enter MPIU_Thread_mutex_lock %p", (mutex_ptr_)); \
+        OPA_incr_int(&(mutex_ptr_)->num_queued_threads);                \
+        err__ = pthread_mutex_lock(&(mutex_ptr_)->mutex);               \
+        OPA_decr_int(&(mutex_ptr_)->num_queued_threads);                \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+        *(int *)(err_ptr_) = err__;                                     \
+        MPIU_DBG_MSG_P(THREAD,VERBOSE,"exit MPIU_Thread_mutex_lock %p", (mutex_ptr_)); \
+    } while (0)
+
 #else /* MPICH_DEBUG_MUTEX */
-#define MPIU_Thread_mutex_lock(mutex_ptr_, err_ptr_)             \
-do {                                                               \
-    int err__;                                                  \
-    MPIU_DBG_MSG_P(THREAD,VERBOSE,"enter MPIU_Thread_mutex_lock %p", (mutex_ptr_));      \
-    OPA_incr_int(&(mutex_ptr_)->num_queued_threads);                  \
-    err__ = pthread_mutex_lock(&(mutex_ptr_)->mutex);                   \
-    OPA_decr_int(&(mutex_ptr_)->num_queued_threads);                 \
-    if (err__)                                                  \
-    {                                                           \
-        MPIU_DBG_MSG_S(THREAD,TERSE,"  mutex lock error: %s", MPIU_Strerror(err__));       \
-        MPL_internal_sys_error_printf("pthread_mutex_lock", err__,\
-                                       "    %s:%d\n", __FILE__, __LINE__);\
-    }                                                          \
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */     \
-    *(int *)(err_ptr_) = err__;                                \
-    MPIU_DBG_MSG_P(THREAD,VERBOSE,"exit MPIU_Thread_mutex_lock %p", (mutex_ptr_));      \
-} while (0)
-#endif
-
-#ifndef MPICH_DEBUG_MUTEX
-#define MPIU_Thread_mutex_unlock(mutex_ptr_, err_ptr_)           \
-do {                                                               \
-    int err__;                                                  \
-                                                                \
-    MPIU_DBG_MSG_P(THREAD,TYPICAL,"MPIU_Thread_mutex_unlock %p", (mutex_ptr_));    \
-    err__ = pthread_mutex_unlock(&(mutex_ptr_)->mutex);                 \
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */      \
-    *(int *)(err_ptr_) = err__;                                 \
-} while (0)
+
+#define MPIU_Thread_mutex_lock(mutex_ptr_, err_ptr_)                    \
+    do {                                                                \
+        int err__;                                                      \
+        MPIU_DBG_MSG_P(THREAD,VERBOSE,"enter MPIU_Thread_mutex_lock %p", (mutex_ptr_)); \
+        OPA_incr_int(&(mutex_ptr_)->num_queued_threads);                \
+        err__ = pthread_mutex_lock(&(mutex_ptr_)->mutex);               \
+        OPA_decr_int(&(mutex_ptr_)->num_queued_threads);                \
+        if (err__) {                                                    \
+            MPIU_DBG_MSG_S(THREAD,TERSE,"  mutex lock error: %s", MPIU_Strerror(err__)); \
+            MPL_internal_sys_error_printf("pthread_mutex_lock", err__,  \
+                                          "    %s:%d\n", __FILE__, __LINE__); \
+        }                                                               \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+        *(int *)(err_ptr_) = err__;                                     \
+        MPIU_DBG_MSG_P(THREAD,VERBOSE,"exit MPIU_Thread_mutex_lock %p", (mutex_ptr_)); \
+    } while (0)
+
+#endif /* MPICH_DEBUG_MUTEX */
+
+
+#if !defined(MPICH_DEBUG_MUTEX)
+
+#define MPIU_Thread_mutex_unlock(mutex_ptr_, err_ptr_)                  \
+    do {                                                                \
+        int err__;                                                      \
+                                                                        \
+        MPIU_DBG_MSG_P(THREAD,TYPICAL,"MPIU_Thread_mutex_unlock %p", (mutex_ptr_)); \
+        err__ = pthread_mutex_unlock(&(mutex_ptr_)->mutex);             \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+        *(int *)(err_ptr_) = err__;                                     \
+    } while (0)
+
 #else /* MPICH_DEBUG_MUTEX */
-#define MPIU_Thread_mutex_unlock(mutex_ptr_, err_ptr_)           \
-do {                                                               \
-    int err__;                                                  \
-                                                                \
-    MPIU_DBG_MSG_P(THREAD,VERBOSE,"MPIU_Thread_mutex_unlock %p", (mutex_ptr_));    \
-    err__ = pthread_mutex_unlock(&(mutex_ptr_)->mutex);                 \
-    if (err__)                                                  \
-    {                                                           \
-        MPIU_DBG_MSG_S(THREAD,TERSE,"  mutex unlock error: %s", MPIU_Strerror(err__));     \
-        MPL_internal_sys_error_printf("pthread_mutex_unlock", err__,         \
-                                       "    %s:%d\n", __FILE__, __LINE__);    \
-    }                                                           \
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */      \
-    *(int *)(err_ptr_) = err__;                                 \
-} while (0)
-#endif
-
-#ifndef MPICH_DEBUG_MUTEX
-#define MPIU_Thread_mutex_trylock(mutex_ptr_, flag_ptr_, err_ptr_)    \
-do {                                                                    \
-    int err__;                                                       \
-                                                                     \
-    err__ = pthread_mutex_trylock(&(mutex_ptr_)->mutex);             \
-    *(flag_ptr_) = (err__ == 0) ? TRUE : FALSE;                      \
-    MPIU_DBG_MSG_FMT(THREAD,VERBOSE,(MPIU_DBG_FDEST, "MPIU_Thread_mutex_trylock mutex=%p result=%s", (mutex_ptr_), (*(flag_ptr_) ? "success" : "failure")));    \
-    *(int *)(err_ptr_) = (err__ == EBUSY) ? MPIU_THREAD_SUCCESS : err__; \
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */              \
-} while (0)
+
+#define MPIU_Thread_mutex_unlock(mutex_ptr_, err_ptr_)                  \
+    do {                                                                \
+        int err__;                                                      \
+                                                                        \
+        MPIU_DBG_MSG_P(THREAD,VERBOSE,"MPIU_Thread_mutex_unlock %p", (mutex_ptr_)); \
+        err__ = pthread_mutex_unlock(&(mutex_ptr_)->mutex);             \
+        if (err__) {                                                    \
+            MPIU_DBG_MSG_S(THREAD,TERSE,"  mutex unlock error: %s", MPIU_Strerror(err__)); \
+            MPL_internal_sys_error_printf("pthread_mutex_unlock", err__, \
+                                          "    %s:%d\n", __FILE__, __LINE__); \
+        }                                                               \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+        *(int *)(err_ptr_) = err__;                                     \
+    } while (0)
+
+#endif  /* MPICH_DEBUG_MUTEX */
+
+
+#if !defined(MPICH_DEBUG_MUTEX)
+
+#define MPIU_Thread_mutex_trylock(mutex_ptr_, flag_ptr_, err_ptr_)      \
+    do {                                                                \
+        int err__;                                                      \
+                                                                        \
+        err__ = pthread_mutex_trylock(&(mutex_ptr_)->mutex);            \
+        *(flag_ptr_) = (err__ == 0) ? TRUE : FALSE;                     \
+        MPIU_DBG_MSG_FMT(THREAD,VERBOSE,(MPIU_DBG_FDEST, "MPIU_Thread_mutex_trylock mutex=%p result=%s", (mutex_ptr_), (*(flag_ptr_) ? "success" : "failure"))); \
+        *(int *)(err_ptr_) = (err__ == EBUSY) ? MPIU_THREAD_SUCCESS : err__; \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+    } while (0)
+
 #else /* MPICH_DEBUG_MUTEX */
-#define MPIU_Thread_mutex_trylock(mutex_ptr_, flag_ptr_, err_ptr_)    \
-do {                                                                    \
-    int err__;                                                       \
-                                                                     \
-    err__ = pthread_mutex_trylock(&(mutex_ptr_)->mutex);             \
-    if (err__ && err__ != EBUSY)                                     \
-    {                                                                \
-        MPIU_DBG_MSG_S(THREAD,TERSE,"  mutex trylock error: %s", MPIU_Strerror(err__));    \
-        MPL_internal_sys_error_printf("pthread_mutex_trylock", err__,\
-                                       "    %s:%d\n", __FILE__, __LINE__);\
-    }                                                                \
-    *(flag_ptr_) = (err__ == 0) ? TRUE : FALSE;                      \
-    MPIU_DBG_MSG_FMT(THREAD,VERBOSE,(MPIU_DBG_FDEST, "MPIU_Thread_mutex_trylock mutex=%p result=%s", (mutex_ptr_), (*(flag_ptr_) ? "success" : "failure")));    \
-    *(int *)(err_ptr_) = (err__ == EBUSY) ? MPIU_THREAD_SUCCESS : err__; \
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */              \
-} while (0)
-#endif
+
+#define MPIU_Thread_mutex_trylock(mutex_ptr_, flag_ptr_, err_ptr_)      \
+    do {                                                                \
+        int err__;                                                      \
+                                                                        \
+        err__ = pthread_mutex_trylock(&(mutex_ptr_)->mutex);            \
+        if (err__ && err__ != EBUSY)                                    \
+        {                                                               \
+            MPIU_DBG_MSG_S(THREAD,TERSE,"  mutex trylock error: %s", MPIU_Strerror(err__)); \
+            MPL_internal_sys_error_printf("pthread_mutex_trylock", err__, \
+                                          "    %s:%d\n", __FILE__, __LINE__); \
+        }                                                               \
+        *(flag_ptr_) = (err__ == 0) ? TRUE : FALSE;                     \
+        MPIU_DBG_MSG_FMT(THREAD,VERBOSE,(MPIU_DBG_FDEST, "MPIU_Thread_mutex_trylock mutex=%p result=%s", (mutex_ptr_), (*(flag_ptr_) ? "success" : "failure"))); \
+        *(int *)(err_ptr_) = (err__ == EBUSY) ? MPIU_THREAD_SUCCESS : err__; \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+    } while (0)
+
+#endif /* MPICH_DEBUG_MUTEX */
+
 
 /*
  * Condition Variables
  */
 
 #define MPIU_Thread_cond_create(cond_ptr_, err_ptr_)                    \
-  do {                                                                  \
-      int err__;							\
+    do {                                                                \
+        int err__;							\
                                                                         \
-      err__ = pthread_cond_init((cond_ptr_), NULL);                     \
-      MPIU_DBG_MSG_P(THREAD,TYPICAL,"Created MPIU_Thread_cond %p", (cond_ptr_)); \
-      /* FIXME: convert error to an MPIU_THREAD_ERR value */            \
-      *(int *)(err_ptr_) = err__;                                       \
-  } while (0)
+        err__ = pthread_cond_init((cond_ptr_), NULL);                   \
+        MPIU_DBG_MSG_P(THREAD,TYPICAL,"Created MPIU_Thread_cond %p", (cond_ptr_)); \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+        *(int *)(err_ptr_) = err__;                                     \
+    } while (0)
 
 #define MPIU_Thread_cond_destroy(cond_ptr_, err_ptr_)                   \
-  do {                                                                  \
-      int err__;							\
+    do {                                                                \
+        int err__;							\
                                                                         \
-      MPIU_DBG_MSG_P(THREAD,TYPICAL,"About to destroy MPIU_Thread_cond %p", (cond_ptr_)); \
-      err__ = pthread_cond_destroy(cond_ptr_);                          \
-      /* FIXME: convert error to an MPIU_THREAD_ERR value */            \
-      *(int *)(err_ptr_) = err__;                                       \
-  } while (0)
+        MPIU_DBG_MSG_P(THREAD,TYPICAL,"About to destroy MPIU_Thread_cond %p", (cond_ptr_)); \
+        err__ = pthread_cond_destroy(cond_ptr_);                        \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+        *(int *)(err_ptr_) = err__;                                     \
+    } while (0)
 
 #define MPIU_Thread_cond_wait(cond_ptr_, mutex_ptr_, err_ptr_)		\
-do {                                                                       \
-    int err__;								\
+    do {                                                                \
+        int err__;                                                      \
     									\
-    /* The latest pthread specification says that cond_wait routines    \
-       aren't allowed to return EINTR,	                                \
-       but some of the older implementations still do. */		\
-    MPIU_DBG_MSG_FMT(THREAD,TYPICAL,(MPIU_DBG_FDEST,"Enter cond_wait on cond=%p mutex=%p",(cond_ptr_),(mutex_ptr_))) \
-    do									\
-    {									\
-        OPA_incr_int(&(mutex_ptr_)->num_queued_threads);              \
-	err__ = pthread_cond_wait((cond_ptr_), &(mutex_ptr_)->mutex);   \
-        OPA_decr_int(&(mutex_ptr_)->num_queued_threads);             \
-    }									\
-    while (err__ == EINTR);						\
+        /* The latest pthread specification says that cond_wait         \
+         * routines aren't allowed to return EINTR, but some of the     \
+         * older implementations still do. */                           \
+        MPIU_DBG_MSG_FMT(THREAD,TYPICAL,(MPIU_DBG_FDEST,"Enter cond_wait on cond=%p mutex=%p",(cond_ptr_),(mutex_ptr_))) \
+            do {                                                        \
+                OPA_incr_int(&(mutex_ptr_)->num_queued_threads);        \
+                err__ = pthread_cond_wait((cond_ptr_), &(mutex_ptr_)->mutex); \
+                OPA_decr_int(&(mutex_ptr_)->num_queued_threads);        \
+            }                                                           \
+            while (err__ == EINTR);                                     \
 									\
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */		\
-    *(int *)(err_ptr_) = err__;                                         \
-    MPIU_Assert_fmt_msg(err__ == 0,                   \
-                        ("cond_wait failed, err=%d (%s)",err__,strerror(err__))); \
-    MPIU_DBG_MSG_FMT(THREAD,TYPICAL,(MPIU_DBG_FDEST,"Exit cond_wait on cond=%p mutex=%p",(cond_ptr_),(mutex_ptr_))) \
-} while (0)
-
-#define MPIU_Thread_cond_broadcast(cond_ptr_, err_ptr_)		\
-do {                                                               \
-    int err__;							\
-    								\
-    MPIU_DBG_MSG_P(THREAD,TYPICAL,"About to cond_broadcast on MPIU_Thread_cond %p", (cond_ptr_));    \
-    err__ = pthread_cond_broadcast(cond_ptr_);			\
-								\
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */	\
-    *(int *)(err_ptr_) = err__;                                 \
-    MPIU_Assert_fmt_msg(err__ == 0,                     \
-                        ("cond_broadcast failed, err__=%d (%s)",err__,strerror(err__))); \
-} while (0)
-
-#define MPIU_Thread_cond_signal(cond_ptr_, err_ptr_)		\
-do {                                                               \
-    int err__;							\
-								\
-    MPIU_DBG_MSG_P(THREAD,TYPICAL,"About to cond_signal on MPIU_Thread_cond %p", (cond_ptr_));    \
-    err__ = pthread_cond_signal(cond_ptr_);			\
-								\
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */	\
-    *(int *)(err_ptr_) = err__;                                 \
-    MPIU_Assert_fmt_msg(err__ == 0,                                     \
-                        ("cond_signal failed, err__=%d (%s)",err__,strerror(err__))); \
-} while (0)
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */		\
+        *(int *)(err_ptr_) = err__;                                     \
+        MPIU_Assert_fmt_msg(err__ == 0,                                 \
+                            ("cond_wait failed, err=%d (%s)",err__,strerror(err__))); \
+        MPIU_DBG_MSG_FMT(THREAD,TYPICAL,(MPIU_DBG_FDEST,"Exit cond_wait on cond=%p mutex=%p",(cond_ptr_),(mutex_ptr_))); \
+    } while (0)
+
+#define MPIU_Thread_cond_broadcast(cond_ptr_, err_ptr_)                 \
+    do {                                                                \
+        int err__;							\
+                                                                        \
+        MPIU_DBG_MSG_P(THREAD,TYPICAL,"About to cond_broadcast on MPIU_Thread_cond %p", (cond_ptr_)); \
+        err__ = pthread_cond_broadcast(cond_ptr_);			\
+                                                                        \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+        *(int *)(err_ptr_) = err__;                                     \
+        MPIU_Assert_fmt_msg(err__ == 0,                                 \
+                            ("cond_broadcast failed, err__=%d (%s)",err__,strerror(err__))); \
+    } while (0)
+
+#define MPIU_Thread_cond_signal(cond_ptr_, err_ptr_)                    \
+    do {                                                                \
+        int err__;							\
+                                                                        \
+        MPIU_DBG_MSG_P(THREAD,TYPICAL,"About to cond_signal on MPIU_Thread_cond %p", (cond_ptr_)); \
+        err__ = pthread_cond_signal(cond_ptr_);                         \
+                                                                        \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+        *(int *)(err_ptr_) = err__;                                     \
+        MPIU_Assert_fmt_msg(err__ == 0,                                 \
+                            ("cond_signal failed, err__=%d (%s)",err__,strerror(err__))); \
+    } while (0)
 
 
 /*
@@ -285,43 +303,43 @@ do {                                                               \
  */
 
 #define MPIU_Thread_tls_create(exit_func_ptr_, tls_ptr_, err_ptr_)	\
-do {                                                                       \
-    int err__;								\
+    do {                                                                \
+        int err__;                                                      \
     									\
-    err__ = pthread_key_create((tls_ptr_), (exit_func_ptr_));		\
+        err__ = pthread_key_create((tls_ptr_), (exit_func_ptr_));       \
 									\
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */		\
-    *(int *)(err_ptr_) = err__;                                         \
-} while (0)
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */		\
+        *(int *)(err_ptr_) = err__;                                     \
+    } while (0)
 
 #define MPIU_Thread_tls_destroy(tls_ptr_, err_ptr_)		\
-do {                                                               \
-    int err__;							\
+    do {                                                        \
+        int err__;                                              \
     								\
-    err__ = pthread_key_delete(*(tls_ptr_));			\
+        err__ = pthread_key_delete(*(tls_ptr_));                \
 								\
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */	\
-    *(int *)(err_ptr_) = err__;                                 \
-} while (0)
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */	\
+        *(int *)(err_ptr_) = err__;                             \
+    } while (0)
 
-#define MPIU_Thread_tls_set(tls_ptr_, value_, err_ptr_)		\
-do {                                                               \
-    int err__;							\
-								\
-    err__ = pthread_setspecific(*(tls_ptr_), (value_));		\
-								\
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */	\
-    *(int *)(err_ptr_) = err__;                             \
-    MPIU_Assert_fmt_msg(err__ == 0,                     \
-                        ("tls_set failed, err__=%d (%s)",err__,strerror(err__))); \
-} while (0)
+#define MPIU_Thread_tls_set(tls_ptr_, value_, err_ptr_)                 \
+    do {                                                                \
+        int err__;							\
+                                                                        \
+        err__ = pthread_setspecific(*(tls_ptr_), (value_));		\
+                                                                        \
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */          \
+        *(int *)(err_ptr_) = err__;                                     \
+        MPIU_Assert_fmt_msg(err__ == 0,                                 \
+                            ("tls_set failed, err__=%d (%s)",err__,strerror(err__))); \
+    } while (0)
 
 #define MPIU_Thread_tls_get(tls_ptr_, value_ptr_, err_ptr_)	\
-do {                                                               \
-    *(value_ptr_) = pthread_getspecific(*(tls_ptr_));		\
+    do {                                                        \
+        *(value_ptr_) = pthread_getspecific(*(tls_ptr_));       \
 								\
-    /* FIXME: convert error to an MPIU_THREAD_ERR value */	\
-    *(int *)(err_ptr_) = MPIU_THREAD_SUCCESS;                   \
-} while (0)
+        /* FIXME: convert error to an MPIU_THREAD_ERR value */	\
+        *(int *)(err_ptr_) = MPIU_THREAD_SUCCESS;               \
+    } while (0)
 
 #endif /* MPIU_THREAD_POSIX_FUNCS_H_INCLUDED */
diff --git a/src/util/thread/mpiu_thread_posix_types.h b/src/util/thread/mpiu_thread_posix_types.h
index 4c793a1..024e590 100644
--- a/src/util/thread/mpiu_thread_posix_types.h
+++ b/src/util/thread/mpiu_thread_posix_types.h
@@ -15,9 +15,9 @@ typedef struct {
     pthread_mutex_t mutex;
     OPA_int_t num_queued_threads;
 } MPIU_Thread_mutex_t;
-typedef pthread_cond_t  MPIU_Thread_cond_t;
-typedef pthread_t       MPIU_Thread_id_t;
-typedef pthread_key_t   MPIU_Thread_tls_t;
+typedef pthread_cond_t MPIU_Thread_cond_t;
+typedef pthread_t MPIU_Thread_id_t;
+typedef pthread_key_t MPIU_Thread_tls_t;
 
 #define MPIU_THREAD_TLS_T_NULL 0
 
diff --git a/src/util/thread/mpiu_thread_priv.h b/src/util/thread/mpiu_thread_priv.h
index 25afaef..609e8cb 100644
--- a/src/util/thread/mpiu_thread_priv.h
+++ b/src/util/thread/mpiu_thread_priv.h
@@ -105,7 +105,7 @@ extern MPIU_TLS_SPECIFIER MPICH_PerThread_t MPIU_Thread;
 #define MPIU_THREADPRIV_DECL
 #define MPIU_THREADPRIV_GET
 #define MPIU_THREADPRIV_FIELD(a_) (MPIU_Thread.a_)
-#define MPIU_THREADPRIV_FINALIZE do{}while(0)
+#define MPIU_THREADPRIV_FINALIZE do {} while (0)
 
 #endif /* defined(MPIU_TLS_SPECIFIER) */
 
diff --git a/src/util/thread/mpiu_thread_solaris_funcs.h b/src/util/thread/mpiu_thread_solaris_funcs.h
index dba7b76..d3cdff4 100644
--- a/src/util/thread/mpiu_thread_solaris_funcs.h
+++ b/src/util/thread/mpiu_thread_solaris_funcs.h
@@ -14,27 +14,27 @@
 /* MPIU_Thread_create() defined in mpiu_thread.c */
 
 #define MPIU_Thread_exit()			\
-do {                                               \
-    thr_exit(NULL);				\
-} while (0)
+    do {                                        \
+        thr_exit(NULL);				\
+    } while (0)
 
 #define MPIU_Thread_self(id_ptr_)		\
-do {                                               \
-    *(id_ptr_) = thr_self();			\
-} while (0)
+    do {                                        \
+        *(id_ptr_) = thr_self();                \
+    } while (0)
 
-#define MPIU_Thread_same(id1_ptr_, id2_ptr_, same_ptr_)	\
-do {                                                       \
-    *(same_ptr_) = (*(id1_ptr_) == *(id2_ptr_)) ? TRUE : FALSE;		\
-} while (0)
+#define MPIU_Thread_same(id1_ptr_, id2_ptr_, same_ptr_)                 \
+    do {                                                                \
+        *(same_ptr_) = (*(id1_ptr_) == *(id2_ptr_)) ? TRUE : FALSE;     \
+    } while (0)
 
-#define MPIU_Thread_yield(mutex_ptr_)              \
-do {                                               \
-    int err;                                            \
-    MPIU_Thread_mutex_unlock(mutex_ptr_, &err);         \
-    thr_yield();                                   \
-    MPIU_Thread_mutex_lock(mutex_ptr_, &err);      \
-} while (0)
+#define MPIU_Thread_yield(mutex_ptr_)                   \
+    do {                                                \
+        int err;                                        \
+        MPIU_Thread_mutex_unlock(mutex_ptr_, &err);     \
+        thr_yield();                                    \
+        MPIU_Thread_mutex_lock(mutex_ptr_, &err);       \
+    } while (0)
 
 
 /*
@@ -42,65 +42,57 @@ do {                                               \
  */
 
 #define MPIU_Thread_mutex_create(mutex_ptr_, err_ptr_)	\
-do {                                                       \
-    *(mutex_ptr_) = DEFAULTMUTEX;			\
-    if ((err_ptr_) == NULL)				\
-    { 							\
-	*(err_ptr_) = MPIU_THREAD_SUCCESS;		\
-    }							\
-} while (0)
-
-#define MPIU_Thread_mutex_destroy(mutex_ptr_, err_ptr_)		\
-do {                                                               \
-    if ((err_ptr_) == NULL)					\
-    { 								\
-	mutex_destroy(mutex_ptr_);				\
-    }								\
-    else							\
-    {								\
-	*(err_ptr_) = mutex_destroy(mutex_ptr_);		\
-	/* FIXME: convert error to an MPIU_THREAD_ERR value */	\
-    }								\
-} while (0)
-
-#define MPIU_Thread_mutex_lock(mutex_ptr_, err_ptr_)		\
-do {                                                               \
-    if ((err_ptr_) == NULL)					\
-    { 								\
-	mutex_lock(mutex_ptr_);					\
-    }								\
-    else							\
-    {								\
-	*(err_ptr_) = mutex_lock(mutex_ptr_);			\
-	/* FIXME: convert error to an MPIU_THREAD_ERR value */	\
-    }								\
-} while (0)
-
-#define MPIU_Thread_mutex_unlock(mutex_ptr_, err_ptr_)		\
-do {                                                               \
-    if ((err_ptr_) == NULL)					\
-    { 								\
-	mutex_unlock(mutex_ptr_);				\
-    }								\
-    else							\
-    {								\
-	*(err_ptr_) = mutex_unlock(mutex_ptr_);			\
-	/* FIXME: convert error to an MPIU_THREAD_ERR value */	\
-    }								\
-} while (0)
+    do {                                                \
+        *(mutex_ptr_) = DEFAULTMUTEX;			\
+        if ((err_ptr_) == NULL) {                       \
+            *(err_ptr_) = MPIU_THREAD_SUCCESS;		\
+        }                                               \
+    } while (0)
+
+#define MPIU_Thread_mutex_destroy(mutex_ptr_, err_ptr_)                 \
+    do {                                                                \
+        if ((err_ptr_) == NULL) {                                       \
+            mutex_destroy(mutex_ptr_);                                  \
+        }								\
+        else {                                                          \
+            *(err_ptr_) = mutex_destroy(mutex_ptr_);                    \
+            /* FIXME: convert error to an MPIU_THREAD_ERR value */	\
+        }								\
+    } while (0)
+
+#define MPIU_Thread_mutex_lock(mutex_ptr_, err_ptr_)                    \
+    do {                                                                \
+        if ((err_ptr_) == NULL) {                                       \
+            mutex_lock(mutex_ptr_);					\
+        }								\
+        else {                                                          \
+            *(err_ptr_) = mutex_lock(mutex_ptr_);			\
+            /* FIXME: convert error to an MPIU_THREAD_ERR value */	\
+        }								\
+    } while (0)
+
+#define MPIU_Thread_mutex_unlock(mutex_ptr_, err_ptr_)                  \
+    do {                                                                \
+        if ((err_ptr_) == NULL) {                                       \
+            mutex_unlock(mutex_ptr_);                                   \
+        }								\
+        else {                                                          \
+            *(err_ptr_) = mutex_unlock(mutex_ptr_);			\
+            /* FIXME: convert error to an MPIU_THREAD_ERR value */	\
+        }								\
+    } while (0)
 
 #define MPIU_Thread_mutex_trylock(mutex_ptr_, flag_ptr_, err_ptr_)	\
-do {                                                                       \
-    int err__;								\
+    do {                                                                \
+        int err__;                                                      \
     									\
-    err__ = mutex_trylock(mutex_ptr_);					\
-    *(flag_ptr_) = (err__ == 0) ? TRUE : FALSE;				\
-    if ((err_ptr_) != NULL)						\
-    {									\
-	*(err_ptr_) = (err__ == EBUSY) : MPIU_THREAD_SUCCESS ? err__;	\
-	/* FIXME: convert error to an MPIU_THREAD_ERR value */		\
-    }									\
-} while (0)
+        err__ = mutex_trylock(mutex_ptr_);                              \
+        *(flag_ptr_) = (err__ == 0) ? TRUE : FALSE;                     \
+        if ((err_ptr_) != NULL) {                                       \
+            *(err_ptr_) = (err__ == EBUSY) : MPIU_THREAD_SUCCESS ? err__; \
+            /* FIXME: convert error to an MPIU_THREAD_ERR value */      \
+        }                                                               \
+    } while (0)
 
 
 /*
@@ -108,123 +100,109 @@ do {                                                                       \
  */
 
 #define MPIU_Thread_cond_create(cond_ptr_, err_ptr_)	\
-do {                                                       \
-    *(cond_ptr_) = DEFAULTCV;				\
-    if ((err_ptr_) == NULL)				\
-    { 							\
-	*(err_ptr_) = MPIU_THREAD_SUCCESS;		\
-    }							\
-} while (0)
-
-#define MPIU_Thread_cond_destroy(cond_ptr_, err_ptr_)		\
-do {                                                               \
-    if ((err_ptr_) == NULL)					\
-    { 								\
-	cond_destroy(cond_ptr_);				\
-    }								\
-    else							\
-    {								\
-	*(err_ptr_) = cond_destroy(cond_ptr_);			\
-	/* FIXME: convert error to a MPIU_THREAD_ERR value */	\
-    }								\
-} while (0)
-
-#define MPIU_Thread_cond_wait(cond_ptr_, mutex_ptr_, err_ptr_)	\
-do {                                                               \
-    if ((err_ptr_) == NULL)					\
-    { 								\
-	cond_wait((cond_ptr_), (mutex_ptr_));			\
-    }								\
-    else							\
-    {								\
-	*(err_ptr_) = cond_wait((cond_ptr_), (mutex_ptr_));	\
-	/* FIXME: convert error to a MPIU_THREAD_ERR value */	\
-    }								\
-} while (0)
-
-#define MPIU_Thread_cond_broadcast(cond_ptr_, err_ptr_)		\
-do {                                                               \
-    if ((err_ptr_) == NULL)					\
-    { 								\
-	cond_broadcast(cond_ptr_);				\
-    }								\
-    else							\
-    {								\
-	*(err_ptr_) = cond_broadcast(cond_ptr_);		\
-	/* FIXME: convert error to a MPIU_THREAD_ERR value */	\
-    }								\
-} while (0)
-
-#define MPIU_Thread_cond_signal(cond_ptr_, err_ptr_)		\
-do {                                                               \
-    if ((err_ptr_) == NULL)					\
-    { 								\
-	cond_signal(cond_ptr_);					\
-    }								\
-    else							\
-    {								\
-	*(err_ptr_) = cond_signal(cond_ptr_);			\
-	/* FIXME: convert error to a MPIU_THREAD_ERR value */	\
-    }								\
-} while (0)
+    do {                                                \
+        *(cond_ptr_) = DEFAULTCV;                       \
+        if ((err_ptr_) == NULL) {                       \
+            *(err_ptr_) = MPIU_THREAD_SUCCESS;		\
+        }                                               \
+    } while (0)
+
+#define MPIU_Thread_cond_destroy(cond_ptr_, err_ptr_)                   \
+    do {                                                                \
+        if ((err_ptr_) == NULL) {                                       \
+            cond_destroy(cond_ptr_);                                    \
+        }								\
+        else {                                                          \
+            *(err_ptr_) = cond_destroy(cond_ptr_);			\
+            /* FIXME: convert error to a MPIU_THREAD_ERR value */	\
+        }								\
+    } while (0)
+
+#define MPIU_Thread_cond_wait(cond_ptr_, mutex_ptr_, err_ptr_)          \
+    do {                                                                \
+        if ((err_ptr_) == NULL) {                                       \
+            cond_wait((cond_ptr_), (mutex_ptr_));			\
+        }								\
+        else {                                                          \
+            *(err_ptr_) = cond_wait((cond_ptr_), (mutex_ptr_));         \
+            /* FIXME: convert error to a MPIU_THREAD_ERR value */	\
+        }								\
+    } while (0)
+
+#define MPIU_Thread_cond_broadcast(cond_ptr_, err_ptr_)                 \
+    do {                                                                \
+        if ((err_ptr_) == NULL) {                                       \
+            cond_broadcast(cond_ptr_);                                  \
+        }								\
+        else {                                                          \
+            *(err_ptr_) = cond_broadcast(cond_ptr_);                    \
+            /* FIXME: convert error to a MPIU_THREAD_ERR value */	\
+        }								\
+    } while (0)
+
+#define MPIU_Thread_cond_signal(cond_ptr_, err_ptr_)                    \
+    do {                                                                \
+        if ((err_ptr_) == NULL) {                                       \
+            cond_signal(cond_ptr_);					\
+        }								\
+        else {                                                          \
+            *(err_ptr_) = cond_signal(cond_ptr_);			\
+            /* FIXME: convert error to a MPIU_THREAD_ERR value */	\
+        }								\
+    } while (0)
 
 
 /*
  * Thread Local Storage
  */
-typedef void (*MPIU_Thread_tls_exit_func_t)(void * value);
+typedef void (*MPIU_Thread_tls_exit_func_t) (void *value);
 
 
 #define MPIU_Thread_tls_create(exit_func_ptr_, tls_ptr_, err_ptr_)	\
-do {                                                                       \
-    if ((err_ptr_) == NULL)						\
-    {									\
-	thr_keycreate((tls_ptr), (exit_func_ptr));			\
-    }									\
-    else								\
-    {									\
-	*(err_ptr_) = thr_keycreate((tls_ptr), (exit_func_ptr));	\
-	/* FIXME: convert error to a MPIU_THREAD_ERR value */		\
-    }									\
-} while (0)
-
-#define MPIU_Thread_tls_destroy(tls_ptr_, err_ptr_)										  \
-do {                                                                                                                                 \
-    /*																  \
-     * FIXME: Solaris threads does not have a key destroy.  We need to create equivalent functionality to prevent a callback from \
-     * occuring when a thread exits after the TLS is destroyed.  This is the only way to prevent subsystems that have shutdown	  \
-     * from continuing to receive callbacks.											  \
-     */																  \
-    if ((err_ptr_) != NULL)													  \
-    {																  \
-	*(err_ptr) = MPIU_THREAD_SUCCESS;											  \
-    }																  \
-} while (0)
-
-#define MPIU_Thread_tls_set(tls_ptr, value_)			\
-do {                                                               \
-    if ((err_ptr_) == NULL)					\
-    {								\
-	thr_setspecific(*(tls_ptr), (value_));			\
-    }								\
-    else							\
-    {								\
-	*(err_ptr_) = thr_setspecific(*(tls_ptr), (value_));	\
-	/* FIXME: convert error to a MPIU_THREAD_ERR value */	\
-    }								\
-} while (0)
-
-#define MPIU_Thread_tls_get(tls_ptr, value_ptr_)				\
-do {                                                                       \
-    if ((err_ptr_) == NULL)						\
-    {									\
-	thr_setspecific(*(tls_ptr), (value_ptr_));			\
-    }									\
-    else								\
-    {									\
-	*(err_ptr_) = thr_setspecific(*(tls_ptr), (value_ptr_));	\
-	/* FIXME: convert error to a MPIU_THREAD_ERR value */		\
-    }									\
-} while (0)
+    do {                                                                \
+        if ((err_ptr_) == NULL) {                                       \
+            thr_keycreate((tls_ptr), (exit_func_ptr));			\
+        }                                                               \
+        else {								\
+            *(err_ptr_) = thr_keycreate((tls_ptr), (exit_func_ptr));	\
+            /* FIXME: convert error to a MPIU_THREAD_ERR value */       \
+        }                                                               \
+    } while (0)
+
+#define MPIU_Thread_tls_destroy(tls_ptr_, err_ptr_)                     \
+    do {                                                                \
+        /*                                                              \
+         * FIXME: Solaris threads does not have a key destroy.  We      \
+         * need to create equivalent functionality to prevent a         \
+         * callback from occuring when a thread exits after the TLS is  \
+         * destroyed.  This is the only way to prevent subsystems that  \
+         * have shutdown from continuing to receive callbacks.          \
+         */                                                             \
+        if ((err_ptr_) != NULL) {                                       \
+            *(err_ptr) = MPIU_THREAD_SUCCESS;                           \
+        }                                                               \
+    } while (0)
+
+#define MPIU_Thread_tls_set(tls_ptr, value_)                            \
+    do {                                                                \
+        if ((err_ptr_) == NULL) {                                       \
+            thr_setspecific(*(tls_ptr), (value_));			\
+        }								\
+        else {                                                          \
+            *(err_ptr_) = thr_setspecific(*(tls_ptr), (value_));	\
+            /* FIXME: convert error to a MPIU_THREAD_ERR value */	\
+        }								\
+    } while (0)
+
+#define MPIU_Thread_tls_get(tls_ptr, value_ptr_)                        \
+    do {                                                                \
+        if ((err_ptr_) == NULL) {                                       \
+            thr_setspecific(*(tls_ptr), (value_ptr_));			\
+        }                                                               \
+        else {								\
+            *(err_ptr_) = thr_setspecific(*(tls_ptr), (value_ptr_));	\
+            /* FIXME: convert error to a MPIU_THREAD_ERR value */       \
+        }                                                               \
+    } while (0)
 
 #endif /* MPIU_THREAD_SOLARIS_FUNCS_H_INCLUDED */
diff --git a/src/util/thread/mpiu_thread_win_funcs.h b/src/util/thread/mpiu_thread_win_funcs.h
index ff6cd9f..0280b2c 100644
--- a/src/util/thread/mpiu_thread_win_funcs.h
+++ b/src/util/thread/mpiu_thread_win_funcs.h
@@ -7,74 +7,63 @@
 
 #ifndef MPIU_THREAD_WIN_FUNCS_H_INCLUDED
 #define MPIU_THREAD_WIN_FUNCS_H_INCLUDED
+
 /*
  * Thread Local Storage
  */
 
 #define MPIU_Thread_tls_create(exit_func_ptr_, tls_ptr_, err_ptr_)	\
-do{									\
-    *(tls_ptr_) = TlsAlloc();		                                \
-    if ((err_ptr_) != NULL)                                             \
-    {                                                                   \
-        if (*(tls_ptr_) == TLS_OUT_OF_INDEXES)				\
-        {								\
-	    *(int *)(err_ptr_) = GetLastError();			\
-        }								\
-        else                                                            \
-        {                                                               \
-            *(int *)(err_ptr_) = MPIU_THREAD_SUCCESS;                \
+    do {                                                                \
+        *(tls_ptr_) = TlsAlloc();                                       \
+        if ((err_ptr_) != NULL) {                                       \
+            if (*(tls_ptr_) == TLS_OUT_OF_INDEXES) {                    \
+                *(int *)(err_ptr_) = GetLastError();			\
+            }								\
+            else {                                                      \
+                *(int *)(err_ptr_) = MPIU_THREAD_SUCCESS;               \
+            }                                                           \
         }                                                               \
-    }                                                                   \
-}while(0)
+    } while (0)
 
 #define MPIU_Thread_tls_destroy(tls_ptr_, err_ptr_)		\
-do{								\
-    BOOL result__;                                              \
-    result__ = TlsFree(*(tls_ptr_));                            \
-    if ((err_ptr_) != NULL)                                     \
-    {                                                           \
-        if (result__)                                           \
-        {                                                       \
-            *(int *)(err_ptr_) = MPIU_THREAD_SUCCESS;        \
+    do {                                                        \
+        BOOL result__;                                          \
+        result__ = TlsFree(*(tls_ptr_));                        \
+        if ((err_ptr_) != NULL) {                               \
+            if (result__) {                                     \
+                *(int *)(err_ptr_) = MPIU_THREAD_SUCCESS;       \
+            }                                                   \
+            else {                                              \
+                *(int *)(err_ptr_) = GetLastError();		\
+            }							\
         }                                                       \
-        else                                                    \
-        {							\
-	    *(int *)(err_ptr_) = GetLastError();		\
-        }							\
-    }                                                           \
-}while(0)
+    } while (0)
 
 #define MPIU_Thread_tls_set(tls_ptr_, value_, err_ptr_)		\
-do{								\
-    BOOL result__;                                              \
-    result__ = TlsSetValue(*(tls_ptr_), (value_));		\
-    if ((err_ptr_) != NULL)                                     \
-    {                                                           \
-        if (result__)                                           \
-        {                                                       \
-            *(int *)(err_ptr_) = MPIU_THREAD_SUCCESS;        \
+    do {                                                        \
+        BOOL result__;                                          \
+        result__ = TlsSetValue(*(tls_ptr_), (value_));		\
+        if ((err_ptr_) != NULL) {                               \
+            if (result__) {                                     \
+                *(int *)(err_ptr_) = MPIU_THREAD_SUCCESS;       \
+            }                                                   \
+            else {                                              \
+                *(int *)(err_ptr_) = GetLastError();		\
+            }							\
         }                                                       \
-        else                                                    \
-        {							\
-	    *(int *)(err_ptr_) = GetLastError();		\
-        }							\
-    }                                                           \
-}while(0)
+    } while (0)
 
-#define MPIU_Thread_tls_get(tls_ptr_, value_ptr_, err_ptr_)	\
-do{								\
-    *((void **)value_ptr_) = TlsGetValue(*(tls_ptr_));		        \
-    if ((err_ptr_) != NULL)                                     \
-    {                                                           \
-        if (*(value_ptr_) == 0 && GetLastError() != NO_ERROR)	\
-        {							\
-	    *(int *)(err_ptr_) = GetLastError();		\
-        }							\
-        else                                                    \
-        {                                                       \
-            *(int *)(err_ptr_) = MPIU_THREAD_SUCCESS;        \
-        }                                                       \
-    }                                                           \
-}while(0)
+#define MPIU_Thread_tls_get(tls_ptr_, value_ptr_, err_ptr_)             \
+    do {								\
+        *((void **)value_ptr_) = TlsGetValue(*(tls_ptr_));              \
+        if ((err_ptr_) != NULL) {                                       \
+            if (*(value_ptr_) == 0 && GetLastError() != NO_ERROR) {     \
+                *(int *)(err_ptr_) = GetLastError();                    \
+            }                                                           \
+            else {                                                      \
+                *(int *)(err_ptr_) = MPIU_THREAD_SUCCESS;               \
+            }                                                           \
+        }                                                               \
+    } while (0)
 
 #endif /* MPIU_THREAD_WIN_FUNCS_H_INCLUDED */
diff --git a/src/util/thread/mpiu_thread_win_types.h b/src/util/thread/mpiu_thread_win_types.h
index c5cde26..a2d3286 100644
--- a/src/util/thread/mpiu_thread_win_types.h
+++ b/src/util/thread/mpiu_thread_win_types.h
@@ -5,10 +5,10 @@
  *      See COPYRIGHT in top-level directory.
  */
 
-/* For "historical" reasons windows.h includes winsock.h 
+/* For "historical" reasons windows.h includes winsock.h
  * internally and WIN32_MEAN_AND_LEAN is to be defined
- * if we plan to include winsock2.h later on -- in the 
- * include hierarchy -- to prevent type redefinition 
+ * if we plan to include winsock2.h later on -- in the
+ * include hierarchy -- to prevent type redefinition
  * errors...
  */
 #ifndef MPIU_THREAD_WIN_TYPES_H_INCLUDED
@@ -22,13 +22,11 @@ typedef HANDLE MPIU_Thread_mutex_t;
 typedef HANDLE MPIU_Thread_id_t;
 typedef DWORD MPIU_Thread_tls_t;
 
-typedef struct MPIU_Thread_cond_fifo_t
-{
+typedef struct MPIU_Thread_cond_fifo_t {
     HANDLE event;
     struct MPIU_Thread_cond_fifo_t *next;
 } MPIU_Thread_cond_fifo_t;
-typedef struct MPIU_Thread_cond_t
-{
+typedef struct MPIU_Thread_cond_t {
     MPIU_Thread_tls_t tls;
     MPIU_Thread_mutex_t fifo_mutex;
     MPIU_Thread_cond_fifo_t *fifo_head, *fifo_tail;

http://git.mpich.org/mpich.git/commitdiff/8c3a1def822759e116df9a614d64b8012d3794a9

commit 8c3a1def822759e116df9a614d64b8012d3794a9
Author: Pavan Balaji <balaji at anl.gov>
Date:   Fri Aug 14 14:35:22 2015 -0500

    Added search/replace script to the maint directory.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/maint/mpich-replace.sh b/maint/mpich-replace.sh
new file mode 100755
index 0000000..2d56707
--- /dev/null
+++ b/maint/mpich-replace.sh
@@ -0,0 +1,3 @@
+#! /bin/bash
+
+grep -r $1 * | cut -f1 -d':' | uniq | xargs sed -i "s/$1/$2/g"

http://git.mpich.org/mpich.git/commitdiff/c7ff730a5252a06f524ae1a72914b9967a27906c

commit c7ff730a5252a06f524ae1a72914b9967a27906c
Author: Halim Amer <aamer at anl.gov>
Date:   Fri Aug 14 11:12:16 2015 -0500

    Refactor some MPI_ macros into MPIU_
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/binding/fortran/mpif_h/buildiface b/src/binding/fortran/mpif_h/buildiface
index 9f5d95f..f6571fb 100755
--- a/src/binding/fortran/mpif_h/buildiface
+++ b/src/binding/fortran/mpif_h/buildiface
@@ -4416,7 +4416,7 @@ MPIR_Comm_copy_attr_f77_proxy(
     MPI_Fint ierr = 0;
     MPI_Fint fhandle = (MPI_Fint)comm;
     MPI_Fint fkeyval = (MPI_Fint)keyval;
-    MPI_Fint fvalue = (MPI_Fint) MPI_VOID_PTR_CAST_TO_MPI_AINT (value);
+    MPI_Fint fvalue = (MPI_Fint) MPIU_VOID_PTR_CAST_TO_MPI_AINT (value);
     MPI_Fint* fextra  = (MPI_Fint*)extra_state;
     MPI_Fint fnew = 0;
     MPI_Fint fflag = 0;
@@ -4424,7 +4424,7 @@ MPIR_Comm_copy_attr_f77_proxy(
     ((F77_CopyFunction*)user_function)( &fhandle, &fkeyval, fextra, &fvalue, &fnew, &fflag, &ierr );
 
     *flag = MPIR_FROM_FLOG(fflag);
-    *new_value = MPI_AINT_CAST_TO_VOID_PTR ((MPI_Aint) fnew);
+    *new_value = MPIU_AINT_CAST_TO_VOID_PTR ((MPI_Aint) fnew);
     return (int)ierr;
 }
 
@@ -4447,7 +4447,7 @@ MPIR_Comm_delete_attr_f77_proxy(
     MPI_Fint ierr = 0;
     MPI_Fint fhandle = (MPI_Fint)comm;
     MPI_Fint fkeyval = (MPI_Fint)keyval;
-    MPI_Fint fvalue = (MPI_Fint) MPI_VOID_PTR_CAST_TO_MPI_AINT (value);
+    MPI_Fint fvalue = (MPI_Fint) MPIU_VOID_PTR_CAST_TO_MPI_AINT (value);
     MPI_Fint* fextra  = (MPI_Fint*)extra_state;
 
     ((F77_DeleteFunction*)user_function)( &fhandle, &fkeyval, &fvalue, fextra, &ierr );
@@ -5429,7 +5429,7 @@ MPIR_Type_copy_attr_f90_proxy(
     MPI_Fint ierr = 0;
     MPI_Fint fhandle = (MPI_Fint)datatype;
     MPI_Fint fkeyval = (MPI_Fint)keyval;
-    MPI_Aint fvalue = MPI_VOID_PTR_CAST_TO_MPI_AINT (value);
+    MPI_Aint fvalue = MPIU_VOID_PTR_CAST_TO_MPI_AINT (value);
     MPI_Aint* fextra  = (MPI_Aint*)extra_state;
     MPI_Aint fnew = 0;
     MPI_Fint fflag = 0;
@@ -5437,7 +5437,7 @@ MPIR_Type_copy_attr_f90_proxy(
     ((F90_CopyFunction*)user_function)( &fhandle, &fkeyval, fextra, &fvalue, &fnew, &fflag, &ierr );
 
     *flag = MPIR_FROM_FLOG(fflag);
-    *new_value = MPI_AINT_CAST_TO_VOID_PTR (fnew);
+    *new_value = MPIU_AINT_CAST_TO_VOID_PTR (fnew);
     return (int)ierr;
 }
 
@@ -5460,7 +5460,7 @@ MPIR_Type_delete_attr_f90_proxy(
     MPI_Fint ierr = 0;
     MPI_Fint fhandle = (MPI_Fint)datatype;
     MPI_Fint fkeyval = (MPI_Fint)keyval;
-    MPI_Aint fvalue = MPI_VOID_PTR_CAST_TO_MPI_AINT (value);
+    MPI_Aint fvalue = MPIU_VOID_PTR_CAST_TO_MPI_AINT (value);
     MPI_Aint* fextra  = (MPI_Aint*)extra_state;
 
     ((F90_DeleteFunction*)user_function)( &fhandle, &fkeyval, &fvalue, fextra, &ierr );
@@ -5493,7 +5493,7 @@ MPIR_Comm_copy_attr_f90_proxy(
     MPI_Fint ierr = 0;
     MPI_Fint fhandle = (MPI_Fint)comm;
     MPI_Fint fkeyval = (MPI_Fint)keyval;
-    MPI_Aint fvalue = MPI_VOID_PTR_CAST_TO_MPI_AINT (value);
+    MPI_Aint fvalue = MPIU_VOID_PTR_CAST_TO_MPI_AINT (value);
     MPI_Aint* fextra  = (MPI_Aint*)extra_state;
     MPI_Aint fnew = 0;
     MPI_Fint fflag = 0;
@@ -5501,7 +5501,7 @@ MPIR_Comm_copy_attr_f90_proxy(
     ((F90_CopyFunction*)user_function)( &fhandle, &fkeyval, fextra, &fvalue, &fnew, &fflag, &ierr );
 
     *flag = MPIR_FROM_FLOG(fflag);
-    *new_value = MPI_AINT_CAST_TO_VOID_PTR (fnew);
+    *new_value = MPIU_AINT_CAST_TO_VOID_PTR (fnew);
     return (int)ierr;
 }
 
@@ -5524,7 +5524,7 @@ MPIR_Comm_delete_attr_f90_proxy(
     MPI_Fint ierr = 0;
     MPI_Fint fhandle = (MPI_Fint)comm;
     MPI_Fint fkeyval = (MPI_Fint)keyval;
-    MPI_Aint fvalue = MPI_VOID_PTR_CAST_TO_MPI_AINT (value);
+    MPI_Aint fvalue = MPIU_VOID_PTR_CAST_TO_MPI_AINT (value);
     MPI_Aint* fextra  = (MPI_Aint*)extra_state;
 
     ((F90_DeleteFunction*)user_function)( &fhandle, &fkeyval, &fvalue, fextra, &ierr );
@@ -5557,7 +5557,7 @@ MPIR_Win_copy_attr_f90_proxy(
     MPI_Fint ierr = 0;
     MPI_Fint fhandle = (MPI_Fint)win;
     MPI_Fint fkeyval = (MPI_Fint)keyval;
-    MPI_Aint fvalue = MPI_VOID_PTR_CAST_TO_MPI_AINT (value);
+    MPI_Aint fvalue = MPIU_VOID_PTR_CAST_TO_MPI_AINT (value);
     MPI_Aint* fextra  = (MPI_Aint*)extra_state;
     MPI_Aint fnew = 0;
     MPI_Fint fflag = 0;
@@ -5565,7 +5565,7 @@ MPIR_Win_copy_attr_f90_proxy(
     ((F90_CopyFunction*)user_function)( &fhandle, &fkeyval, fextra, &fvalue, &fnew, &fflag, &ierr );
 
     *flag = MPIR_FROM_FLOG(fflag);
-    *new_value = MPI_AINT_CAST_TO_VOID_PTR (fnew);
+    *new_value = MPIU_AINT_CAST_TO_VOID_PTR (fnew);
     return (int)ierr;
 }
 
@@ -5588,7 +5588,7 @@ MPIR_Win_delete_attr_f90_proxy(
     MPI_Fint ierr = 0;
     MPI_Fint fhandle = (MPI_Fint)win;
     MPI_Fint fkeyval = (MPI_Fint)keyval;
-    MPI_Aint fvalue = MPI_VOID_PTR_CAST_TO_MPI_AINT (value);
+    MPI_Aint fvalue = MPIU_VOID_PTR_CAST_TO_MPI_AINT (value);
     MPI_Aint* fextra  = (MPI_Aint*)extra_state;
 
     ((F90_DeleteFunction*)user_function)( &fhandle, &fkeyval, &fvalue, fextra, &ierr );
diff --git a/src/mpi/attr/win_get_attr.c b/src/mpi/attr/win_get_attr.c
index d306f7b..ea88525 100644
--- a/src/mpi/attr/win_get_attr.c
+++ b/src/mpi/attr/win_get_attr.c
@@ -127,7 +127,7 @@ int MPIR_WinGetAttr( MPI_Win win, int win_keyval, void *attribute_val,
 	case MPIR_ATTR_C_TO_FORTRAN(MPI_WIN_BASE):
 	    /* The Fortran routine that matches this routine should
 	       provide an address-sized integer, not an MPI_Fint */
-	    *attr_int = MPI_VOID_PTR_CAST_TO_MPI_AINT(win_ptr->base);
+	    *attr_int = MPIU_VOID_PTR_CAST_TO_MPI_AINT(win_ptr->base);
 	    break;
         case MPIR_ATTR_C_TO_FORTRAN(MPI_WIN_SIZE):
 	    /* We do not need to copy because we return the value,
diff --git a/src/mpi/coll/allgather.c b/src/mpi/coll/allgather.c
index bcd1c69..a61a089 100644
--- a/src/mpi/coll/allgather.c
+++ b/src/mpi/coll/allgather.c
@@ -147,7 +147,7 @@ int MPIR_Allgather_intra (
     MPID_Datatype_get_size_macro( recvtype, type_size );
 
     /* This is the largest offset we add to recvbuf */
-    MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+    MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
 				     (comm_size * recvcount * recvtype_extent));
 
     /* check if multiple threads are calling this collective function */
diff --git a/src/mpi/coll/alltoall.c b/src/mpi/coll/alltoall.c
index 657acf5..ea52a6d 100644
--- a/src/mpi/coll/alltoall.c
+++ b/src/mpi/coll/alltoall.c
@@ -501,9 +501,9 @@ int MPIR_Alltoall_inter(
 
     /* Do the pairwise exchanges */
     max_size = MPIR_MAX(local_size, remote_size);
-    MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+    MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
 				     max_size*recvcount*recvtype_extent);
-    MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
+    MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
 				     max_size*sendcount*sendtype_extent);
     for (i=0; i<max_size; i++) {
         src = (rank - i + max_size) % max_size;
diff --git a/src/mpi/coll/alltoallv.c b/src/mpi/coll/alltoallv.c
index 4fec383..8f5945c 100644
--- a/src/mpi/coll/alltoallv.c
+++ b/src/mpi/coll/alltoallv.c
@@ -152,7 +152,7 @@ int MPIR_Alltoallv_intra(const void *sendbuf, const int *sendcounts, const int *
                 if (recvcounts[dst]) {
                     MPID_Datatype_get_size_macro(recvtype, type_size);
                     if (type_size) {
-                        MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+                        MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
                                                          rdispls[dst]*recv_extent);
                         mpi_errno = MPIC_Irecv((char *)recvbuf+rdispls[dst]*recv_extent,
                                                   recvcounts[dst], recvtype, dst,
@@ -174,7 +174,7 @@ int MPIR_Alltoallv_intra(const void *sendbuf, const int *sendcounts, const int *
                 if (sendcounts[dst]) {
                     MPID_Datatype_get_size_macro(sendtype, type_size);
                     if (type_size) {
-                        MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
+                        MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
                                                          sdispls[dst]*send_extent);
                         mpi_errno = MPIC_Isend((char *)sendbuf+sdispls[dst]*send_extent,
                                                   sendcounts[dst], sendtype, dst,
@@ -282,7 +282,7 @@ int MPIR_Alltoallv_inter(const void *sendbuf, const int *sendcounts, const int *
             recvcount = 0;
         }
         else {
-            MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+            MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
 					     rdispls[src]*recv_extent);
             recvaddr = (char *)recvbuf + rdispls[src]*recv_extent;
             recvcount = recvcounts[src];
@@ -293,7 +293,7 @@ int MPIR_Alltoallv_inter(const void *sendbuf, const int *sendcounts, const int *
             sendcount = 0;
         }
         else {
-            MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
+            MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
 					     sdispls[dst]*send_extent);
             sendaddr = (char *)sendbuf + sdispls[dst]*send_extent;
             sendcount = sendcounts[dst];
diff --git a/src/mpi/coll/gather.c b/src/mpi/coll/gather.c
index 3c6a82b..47f7315 100644
--- a/src/mpi/coll/gather.c
+++ b/src/mpi/coll/gather.c
@@ -135,7 +135,7 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     if (rank == root) 
     {
         MPID_Datatype_get_extent_macro(recvtype, extent);
-        MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf+
+        MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf+
 					 (extent*recvcount*comm_size));
     }
 
@@ -327,7 +327,7 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 		}
 		else {
 		    blocks[0] = sendcount;
-		    struct_displs[0] = MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf;
+		    struct_displs[0] = MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf;
 		    types[0] = sendtype;
 		    /* check for overflow.  work around int limits if needed*/
 		    if (curr_cnt - nbytes != (int)(curr_cnt - nbytes)) {
@@ -338,7 +338,7 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 			    MPIU_Assign_trunc(blocks[1],  curr_cnt - nbytes, int);
 			    types[1] = MPI_BYTE;
 		    }
-		    struct_displs[1] = MPI_VOID_PTR_CAST_TO_MPI_AINT tmp_buf;
+		    struct_displs[1] = MPIU_VOID_PTR_CAST_TO_MPI_AINT tmp_buf;
 		    mpi_errno = MPIR_Type_create_struct_impl(2, blocks, struct_displs, types, &tmp_type);
                     if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     
@@ -623,7 +623,7 @@ int MPIR_Gather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
         if (root == MPI_ROOT)
 	{
             MPID_Datatype_get_extent_macro(recvtype, extent);
-            MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+            MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
 					     (recvcount*remote_size*extent));
 
             for (i=0; i<remote_size; i++)
diff --git a/src/mpi/coll/gatherv.c b/src/mpi/coll/gatherv.c
index eef5dd1..51c3756 100644
--- a/src/mpi/coll/gatherv.c
+++ b/src/mpi/coll/gatherv.c
@@ -110,7 +110,7 @@ int MPIR_Gatherv (
 
         MPID_Datatype_get_extent_macro(recvtype, extent);
 	/* each node can make sure it is not going to overflow aint */
-        MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+        MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
 					 displs[rank] * extent);
 
         MPIU_CHKLMEM_MALLOC(reqarray, MPID_Request **, comm_size * sizeof(MPID_Request *), mpi_errno, "reqarray");
diff --git a/src/mpi/coll/iallgather.c b/src/mpi/coll/iallgather.c
index 13f719c..58da4a8 100644
--- a/src/mpi/coll/iallgather.c
+++ b/src/mpi/coll/iallgather.c
@@ -79,7 +79,7 @@ int MPIR_Iallgather_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype sen
     MPID_Datatype_get_extent_macro( recvtype, recvtype_extent );
 
     /* This is the largest offset we add to recvbuf */
-    MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+    MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
                                      (comm_size * recvcount * recvtype_extent));
 
     /*  copy local data into recvbuf */
@@ -250,7 +250,7 @@ int MPIR_Iallgather_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendt
     MPIR_Type_get_true_extent_impl(recvtype, &recvtype_true_lb, &recvtype_true_extent);
 
     /* This is the largest offset we add to recvbuf */
-    MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+    MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
                                      (comm_size * recvcount * recvtype_extent));
 
     /* allocate a temporary buffer of the same size as recvbuf. */
@@ -355,7 +355,7 @@ int MPIR_Iallgather_ring(const void *sendbuf, int sendcount, MPI_Datatype sendty
     MPID_Datatype_get_extent_macro(recvtype, recvtype_extent);
 
     /* This is the largest offset we add to recvbuf */
-    MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+    MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
                                      (comm_size * recvcount * recvtype_extent));
 
     /* First, load the "local" version in the recvbuf. */
diff --git a/src/mpi/coll/ialltoall.c b/src/mpi/coll/ialltoall.c
index 8bdd163..d319cde 100644
--- a/src/mpi/coll/ialltoall.c
+++ b/src/mpi/coll/ialltoall.c
@@ -480,9 +480,9 @@ int MPIR_Ialltoall_inter(const void *sendbuf, int sendcount, MPI_Datatype sendty
 
     /* Do the pairwise exchanges */
     max_size = MPIR_MAX(local_size, remote_size);
-    MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+    MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
                                      max_size*recvcount*recvtype_extent);
-    MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
+    MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
                                      max_size*sendcount*sendtype_extent);
     for (i = 0; i < max_size; i++) {
         src = (rank - i + max_size) % max_size;
diff --git a/src/mpi/coll/ialltoallv.c b/src/mpi/coll/ialltoallv.c
index 97a2661..a811cda 100644
--- a/src/mpi/coll/ialltoallv.c
+++ b/src/mpi/coll/ialltoallv.c
@@ -126,7 +126,7 @@ int MPIR_Ialltoallv_intra(const void *sendbuf, const int sendcounts[], const int
             for (i=0; i < ss; i++) {
                 dst = (rank+i+ii) % comm_size;
                 if (recvcounts[dst] && recvtype_size) {
-                    MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+                    MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
                                                      rdispls[dst]*recv_extent);
                     mpi_errno = MPID_Sched_recv((char *)recvbuf+rdispls[dst]*recv_extent,
                                                 recvcounts[dst], recvtype, dst, comm_ptr, s);
@@ -137,7 +137,7 @@ int MPIR_Ialltoallv_intra(const void *sendbuf, const int sendcounts[], const int
             for (i=0; i < ss; i++) {
                 dst = (rank-i-ii+comm_size) % comm_size;
                 if (sendcounts[dst] && sendtype_size) {
-                    MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
+                    MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
                                                      sdispls[dst]*send_extent);
                     mpi_errno = MPID_Sched_send((char *)sendbuf+sdispls[dst]*send_extent,
                                                 sendcounts[dst], sendtype, dst, comm_ptr, s);
@@ -205,7 +205,7 @@ int MPIR_Ialltoallv_inter(const void *sendbuf, const int sendcounts[], const int
             recvcount = 0;
         }
         else {
-            MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+            MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
                                              rdispls[src]*recv_extent);
             recvaddr = (char *)recvbuf + rdispls[src]*recv_extent;
             recvcount = recvcounts[src];
@@ -216,7 +216,7 @@ int MPIR_Ialltoallv_inter(const void *sendbuf, const int sendcounts[], const int
             sendcount = 0;
         }
         else {
-            MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
+            MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
                                              sdispls[dst]*send_extent);
             sendaddr = (char *)sendbuf + sdispls[dst]*send_extent;
             sendcount = sendcounts[dst];
diff --git a/src/mpi/coll/igather.c b/src/mpi/coll/igather.c
index 44a9af3..9907801 100644
--- a/src/mpi/coll/igather.c
+++ b/src/mpi/coll/igather.c
@@ -91,7 +91,7 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
     if (rank == root)
     {
         MPID_Datatype_get_extent_macro(recvtype, extent);
-        MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf+
+        MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf+
                                          (extent*recvcount*comm_size));
     }
 
@@ -241,10 +241,10 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
                 }
                 else {
                     blocks[0] = sendcount;
-                    struct_displs[0] = MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf;
+                    struct_displs[0] = MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf;
                     types[0] = sendtype;
                     blocks[1] = curr_cnt - nbytes;
-                    struct_displs[1] = MPI_VOID_PTR_CAST_TO_MPI_AINT tmp_buf;
+                    struct_displs[1] = MPIU_VOID_PTR_CAST_TO_MPI_AINT tmp_buf;
                     types[1] = MPI_BYTE;
 
                     mpi_errno = MPIR_Type_create_struct_impl(2, blocks, struct_displs, types, &tmp_type);
@@ -485,7 +485,7 @@ int MPIR_Igather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype
         /* long message. use linear algorithm. */
         if (root == MPI_ROOT) {
             MPID_Datatype_get_extent_macro(recvtype, extent);
-            MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+            MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
                                              (recvcount*remote_size*extent));
 
             for (i=0; i<remote_size; i++) {
diff --git a/src/mpi/coll/igatherv.c b/src/mpi/coll/igatherv.c
index faf3579..b636e25 100644
--- a/src/mpi/coll/igatherv.c
+++ b/src/mpi/coll/igatherv.c
@@ -56,7 +56,7 @@ int MPIR_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, voi
 
         MPID_Datatype_get_extent_macro(recvtype, extent);
         /* each node can make sure it is not going to overflow aint */
-        MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf + displs[rank] * extent);
+        MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf + displs[rank] * extent);
 
         for (i = 0; i < comm_size; i++) {
             if (recvcounts[i]) {
diff --git a/src/mpi/coll/iscatter.c b/src/mpi/coll/iscatter.c
index 0bbc35f..ef23f87 100644
--- a/src/mpi/coll/iscatter.c
+++ b/src/mpi/coll/iscatter.c
@@ -131,7 +131,7 @@ int MPIR_Iscatter_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtyp
                in the event of recvbuf=MPI_IN_PLACE on the root,
                recvcount and recvtype are not valid */
             MPID_Datatype_get_size_macro(sendtype, sendtype_size);
-            MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
+            MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
                                              extent*sendcount*comm_size);
 
             ss->nbytes = sendtype_size * sendcount;
@@ -486,7 +486,7 @@ int MPIR_Iscatter_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtyp
 
                 MPID_Datatype_get_extent_macro(recvtype, extent);
                 MPIU_Ensure_Aint_fits_in_pointer(extent*recvcount*local_size);
-                MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
+                MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
                                                  sendcount*remote_size*extent);
 
                 MPIR_SCHED_CHKPMEM_MALLOC(tmp_buf, void *, recvcount*local_size*(MPIR_MAX(extent,true_extent)),
diff --git a/src/mpi/coll/iscatterv.c b/src/mpi/coll/iscatterv.c
index 9d2c420..a46ead2 100644
--- a/src/mpi/coll/iscatterv.c
+++ b/src/mpi/coll/iscatterv.c
@@ -77,7 +77,7 @@ int MPIR_Iscatterv(const void *sendbuf, const int sendcounts[], const int displs
          * a minimal sanity check. Maybe add a global var since we do
          * loop over sendcount[] in MPI_Scatterv before calling
          * this? */
-        MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf + extent);
+        MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf + extent);
 
         for (i = 0; i < comm_size; i++) {
             if (sendcounts[i]) {
diff --git a/src/mpi/coll/scatter.c b/src/mpi/coll/scatter.c
index 6edf0de..4a852b4 100644
--- a/src/mpi/coll/scatter.c
+++ b/src/mpi/coll/scatter.c
@@ -118,7 +118,7 @@ int MPIR_Scatter_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype
                in the event of recvbuf=MPI_IN_PLACE on the root,
                recvcount and recvtype are not valid */
             MPID_Datatype_get_size_macro(sendtype, sendtype_size);
-            MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
+            MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
 					     extent*sendcount*comm_size);
 
             nbytes = sendtype_size * sendcount;
@@ -485,7 +485,7 @@ int MPIR_Scatter_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype
 
                 MPID_Datatype_get_extent_macro(recvtype, extent);
 		MPIU_Ensure_Aint_fits_in_pointer(extent*recvcount*local_size);
-		MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
+		MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
 						 sendcount*remote_size*extent);
 
                 MPIU_CHKLMEM_MALLOC(tmp_buf, void *, recvcount*local_size*(MPIR_MAX(extent,true_extent)), mpi_errno, "tmp_buf");
diff --git a/src/mpi/coll/scatterv.c b/src/mpi/coll/scatterv.c
index 9370b7d..3be0977 100644
--- a/src/mpi/coll/scatterv.c
+++ b/src/mpi/coll/scatterv.c
@@ -85,7 +85,7 @@ int MPIR_Scatterv(const void *sendbuf, const int *sendcounts, const int *displs,
          * a minimal sanity check. Maybe add a global var since we do
          * loop over sendcount[] in MPI_Scatterv before calling
          * this? */
-        MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf + extent);
+        MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf + extent);
 
         MPIU_CHKLMEM_MALLOC(reqarray, MPID_Request **, comm_size * sizeof(MPID_Request *), mpi_errno, "reqarray");
         MPIU_CHKLMEM_MALLOC(starray, MPI_Status *, comm_size * sizeof(MPI_Status), mpi_errno, "starray");
diff --git a/src/mpi/datatype/address.c b/src/mpi/datatype/address.c
index 866aef2..4557846 100644
--- a/src/mpi/datatype/address.c
+++ b/src/mpi/datatype/address.c
@@ -89,7 +89,7 @@ int MPI_Address(const void *location, MPI_Aint *address)
        standard, I can't tell if this is a compiler bug or a language bug.
     */
 #ifdef CHAR_PTR_IS_ADDRESS
-    *address = MPI_VOID_PTR_CAST_TO_MPI_AINT ((char *) location);
+    *address = MPIU_VOID_PTR_CAST_TO_MPI_AINT ((char *) location);
 #else
     /* Note that this is the "portable" way to generate an address.
        The difference of two pointers is the number of elements
@@ -98,7 +98,7 @@ int MPI_Address(const void *location, MPI_Aint *address)
        of bytes from 0 to location */
     /* To cover the case where a pointer is 32 bits and MPI_Aint is 64 bits,
        add cast to unsigned so the high order address bit is not sign-extended. */
-    *address = MPI_VOID_PTR_CAST_TO_MPI_AINT ((char *) location - (char *) MPI_BOTTOM);
+    *address = MPIU_VOID_PTR_CAST_TO_MPI_AINT ((char *) location - (char *) MPI_BOTTOM);
 #endif
     /* The same code is used in MPI_Get_address */
 
diff --git a/src/mpi/datatype/get_address.c b/src/mpi/datatype/get_address.c
index a53980c..2f291bf 100644
--- a/src/mpi/datatype/get_address.c
+++ b/src/mpi/datatype/get_address.c
@@ -99,14 +99,14 @@ int MPI_Get_address(const void *location, MPI_Aint *address)
        standard, I can't tell if this is a compiler bug or a language bug.
     */
 #ifdef CHAR_PTR_IS_ADDRESS
-    *address = MPI_VOID_PTR_CAST_TO_MPI_AINT ((char *) location);
+    *address = MPIU_VOID_PTR_CAST_TO_MPI_AINT ((char *) location);
 #else
     /* Note that this is the "portable" way to generate an address.
        The difference of two pointers is the number of elements
        between them, so this gives the number of chars between location
        and ptr.  As long as sizeof(char) represents one byte,
        of bytes from 0 to location */
-    *address = MPI_VOID_PTR_CAST_TO_MPI_AINT ((char *) location - (char *) MPI_BOTTOM);
+    *address = MPIU_VOID_PTR_CAST_TO_MPI_AINT ((char *) location - (char *) MPI_BOTTOM);
 #endif
     /* The same code is used in MPI_Address */
 
diff --git a/src/mpi/datatype/pack.c b/src/mpi/datatype/pack.c
index 760554b..3232ee0 100644
--- a/src/mpi/datatype/pack.c
+++ b/src/mpi/datatype/pack.c
@@ -85,7 +85,7 @@ int MPIR_Pack_impl(const void *inbuf,
     last  = SEGMENT_IGNORE_LAST;
 
     /* Ensure that pointer increment fits in a pointer */
-    MPIU_Ensure_Aint_fits_in_pointer((MPI_VOID_PTR_CAST_TO_MPI_AINT outbuf) +
+    MPIU_Ensure_Aint_fits_in_pointer((MPIU_VOID_PTR_CAST_TO_MPI_AINT outbuf) +
 				     (MPI_Aint) *position);
 
     MPID_Segment_pack(segp,
diff --git a/src/mpi/datatype/pack_external.c b/src/mpi/datatype/pack_external.c
index 081ac81..2972fa3 100644
--- a/src/mpi/datatype/pack_external.c
+++ b/src/mpi/datatype/pack_external.c
@@ -137,7 +137,7 @@ int MPI_Pack_external(const char datarep[],
     last  = SEGMENT_IGNORE_LAST;
 
     /* Ensure that pointer increment fits in a pointer */
-    MPIU_Ensure_Aint_fits_in_pointer((MPI_VOID_PTR_CAST_TO_MPI_AINT outbuf) + *position);
+    MPIU_Ensure_Aint_fits_in_pointer((MPIU_VOID_PTR_CAST_TO_MPI_AINT outbuf) + *position);
 
     MPID_Segment_pack_external32(segp,
 				 first,
diff --git a/src/mpi/datatype/unpack.c b/src/mpi/datatype/unpack.c
index 52057a0..a4e56fd 100644
--- a/src/mpi/datatype/unpack.c
+++ b/src/mpi/datatype/unpack.c
@@ -76,7 +76,7 @@ int MPIR_Unpack_impl(const void *inbuf, MPI_Aint insize, MPI_Aint *position,
     last  = SEGMENT_IGNORE_LAST;
 
     /* Ensure that pointer increment fits in a pointer */
-    MPIU_Ensure_Aint_fits_in_pointer((MPI_VOID_PTR_CAST_TO_MPI_AINT inbuf) +
+    MPIU_Ensure_Aint_fits_in_pointer((MPIU_VOID_PTR_CAST_TO_MPI_AINT inbuf) +
 				     (MPI_Aint) *position);
 
     MPID_Segment_unpack(segp,
diff --git a/src/mpi/datatype/unpack_external.c b/src/mpi/datatype/unpack_external.c
index 2f4db11..d9e6d95 100644
--- a/src/mpi/datatype/unpack_external.c
+++ b/src/mpi/datatype/unpack_external.c
@@ -122,7 +122,7 @@ int MPI_Unpack_external(const char datarep[],
     last  = SEGMENT_IGNORE_LAST;
 
     /* Ensure that pointer increment fits in a pointer */
-    MPIU_Ensure_Aint_fits_in_pointer((MPI_VOID_PTR_CAST_TO_MPI_AINT inbuf) + *position);
+    MPIU_Ensure_Aint_fits_in_pointer((MPIU_VOID_PTR_CAST_TO_MPI_AINT inbuf) + *position);
 
     MPID_Segment_unpack_external32(segp,
 				   first,
diff --git a/src/mpi/romio/adio/include/adioi.h b/src/mpi/romio/adio/include/adioi.h
index c813090..4e8e35f 100644
--- a/src/mpi/romio/adio/include/adioi.h
+++ b/src/mpi/romio/adio/include/adioi.h
@@ -1015,7 +1015,7 @@ int  ADIOI_MPE_iwrite_b;
       to (possible) 4 byte ptr cast)                              */
 /* Should work even on 64bit or old 32bit configs                 */
   /* Use MPIU_Ensure_Aint_fits_in_pointer from mpiutil.h and 
-         MPI_AINT_CAST_TO_VOID_PTR from configure (mpi.h) */
+         MPIU_AINT_CAST_TO_VOID_PTR from configure (mpi.h) */
   #include "glue_romio.h"
 
   #define ADIOI_AINT_CAST_TO_VOID_PTR (void*)(MPIU_Pint)
diff --git a/src/mpi/topo/inhb_allgather.c b/src/mpi/topo/inhb_allgather.c
index fe512dc..bfe9254 100644
--- a/src/mpi/topo/inhb_allgather.c
+++ b/src/mpi/topo/inhb_allgather.c
@@ -46,7 +46,7 @@ int MPIR_Ineighbor_allgather_default(const void *sendbuf, int sendcount, MPI_Dat
     MPID_Datatype_get_extent_macro(recvtype, recvtype_extent);
 
     /* This is the largest offset we add to recvbuf */
-    MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+    MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
                                      (comm_ptr->local_size * recvcount * recvtype_extent));
 
     mpi_errno = MPIR_Topo_canon_nhb_count(comm_ptr, &indegree, &outdegree, &weighted);
diff --git a/src/mpi/topo/inhb_allgatherv.c b/src/mpi/topo/inhb_allgatherv.c
index 70ba414..bcad5a7 100644
--- a/src/mpi/topo/inhb_allgatherv.c
+++ b/src/mpi/topo/inhb_allgatherv.c
@@ -49,7 +49,7 @@ int MPIR_Ineighbor_allgatherv_default(const void *sendbuf, int sendcount, MPI_Da
     MPID_Datatype_get_extent_macro(recvtype, recvtype_extent);
 
     for (i = 0; i < comm_size; ++i) {
-        MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+        MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
                                          (displs[i] * recvtype_extent));
     }
 
diff --git a/src/mpi/topo/inhb_alltoall.c b/src/mpi/topo/inhb_alltoall.c
index 8f0bc52..d1fbb46 100644
--- a/src/mpi/topo/inhb_alltoall.c
+++ b/src/mpi/topo/inhb_alltoall.c
@@ -47,10 +47,10 @@ int MPIR_Ineighbor_alltoall_default(const void *sendbuf, int sendcount, MPI_Data
     MPID_Datatype_get_extent_macro(recvtype, recvtype_extent);
 
     /* This is the largest offset we add to sendbuf */
-    MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
+    MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
                                      (comm_ptr->local_size * sendcount * sendtype_extent));
     /* This is the largest offset we add to recvbuf */
-    MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+    MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
                                      (comm_ptr->local_size * recvcount * recvtype_extent));
 
     mpi_errno = MPIR_Topo_canon_nhb_count(comm_ptr, &indegree, &outdegree, &weighted);
diff --git a/src/mpi/topo/inhb_alltoallv.c b/src/mpi/topo/inhb_alltoallv.c
index af999f1..6b7bb75 100644
--- a/src/mpi/topo/inhb_alltoallv.c
+++ b/src/mpi/topo/inhb_alltoallv.c
@@ -51,9 +51,9 @@ int MPIR_Ineighbor_alltoallv_default(const void *sendbuf, const int sendcounts[]
     MPID_Datatype_get_extent_macro(recvtype, recvtype_extent);
 
     for (i = 0; i < comm_size; ++i) {
-        MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
+        MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf +
                                          (sdispls[i] * sendtype_extent));
-        MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+        MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
                                          (rdispls[i] * recvtype_extent));
     }
 
diff --git a/src/mpi/topo/inhb_alltoallw.c b/src/mpi/topo/inhb_alltoallw.c
index b492a7c..0644f48 100644
--- a/src/mpi/topo/inhb_alltoallw.c
+++ b/src/mpi/topo/inhb_alltoallw.c
@@ -53,7 +53,7 @@ int MPIR_Ineighbor_alltoallw_default(const void *sendbuf, const int sendcounts[]
 
     for (k = 0; k < outdegree; ++k) {
         char *sb;
-        MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT sendbuf + sdispls[k]);
+        MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT sendbuf + sdispls[k]);
 
         sb = ((char *)sendbuf) + sdispls[k];
         mpi_errno = MPID_Sched_send(sb, sendcounts[k], sendtypes[k], dsts[k], comm_ptr, s);
@@ -62,7 +62,7 @@ int MPIR_Ineighbor_alltoallw_default(const void *sendbuf, const int sendcounts[]
 
     for (l = 0; l < indegree; ++l) {
         char *rb;
-        MPIU_Ensure_Aint_fits_in_pointer(MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf + rdispls[l]);
+        MPIU_Ensure_Aint_fits_in_pointer(MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf + rdispls[l]);
 
         rb = ((char *)recvbuf) + rdispls[l];
         mpi_errno = MPID_Sched_recv(rb, recvcounts[l], recvtypes[l], srcs[l], comm_ptr, s);
diff --git a/src/mpid/ch3/src/mpid_aint.c b/src/mpid/ch3/src/mpid_aint.c
index b3bc8f1..e5f6af7 100644
--- a/src/mpid/ch3/src/mpid_aint.c
+++ b/src/mpid/ch3/src/mpid_aint.c
@@ -27,7 +27,7 @@ MPI_Aint MPID_Aint_add(MPI_Aint base, MPI_Aint disp)
     MPIDI_STATE_DECL(MPID_STATE_MPID_AINT_ADD);
     MPIDI_FUNC_ENTER(MPID_STATE_MPID_AINT_ADD);
 
-    result =  MPI_VOID_PTR_CAST_TO_MPI_AINT ((char*)MPI_AINT_CAST_TO_VOID_PTR(base) + disp);
+    result =  MPIU_VOID_PTR_CAST_TO_MPI_AINT ((char*)MPIU_AINT_CAST_TO_VOID_PTR(base) + disp);
 
     MPIDI_FUNC_EXIT(MPID_STATE_MPID_AINT_ADD);
     return result;
@@ -54,7 +54,7 @@ MPI_Aint MPID_Aint_diff(MPI_Aint addr1, MPI_Aint addr2)
     MPIDI_STATE_DECL(MPID_STATE_MPID_AINT_DIFF);
     MPIDI_FUNC_ENTER(MPID_STATE_MPID_AINT_DIFF);
 
-    result =  MPI_PTR_DISP_CAST_TO_MPI_AINT ((char*)MPI_AINT_CAST_TO_VOID_PTR(addr1) - (char*)MPI_AINT_CAST_TO_VOID_PTR(addr2));
+    result =  MPIU_PTR_DISP_CAST_TO_MPI_AINT ((char*)MPIU_AINT_CAST_TO_VOID_PTR(addr1) - (char*)MPIU_AINT_CAST_TO_VOID_PTR(addr2));
 
     MPIDI_FUNC_EXIT(MPID_STATE_MPID_AINT_DIFF);
     return result;
diff --git a/src/mpid/common/datatype/mpid_dataloop.h b/src/mpid/common/datatype/mpid_dataloop.h
index 9cdd623..7ff7c94 100644
--- a/src/mpid/common/datatype/mpid_dataloop.h
+++ b/src/mpid/common/datatype/mpid_dataloop.h
@@ -90,9 +90,9 @@
 #define DLOOP_Memcpy MPIU_Memcpy
 
 /* casting macros */
-#define DLOOP_OFFSET_CAST_TO_VOID_PTR MPI_AINT_CAST_TO_VOID_PTR
-#define DLOOP_VOID_PTR_CAST_TO_OFFSET MPI_VOID_PTR_CAST_TO_MPI_AINT
-#define DLOOP_PTR_DISP_CAST_TO_OFFSET MPI_PTR_DISP_CAST_TO_MPI_AINT
+#define DLOOP_OFFSET_CAST_TO_VOID_PTR MPIU_AINT_CAST_TO_VOID_PTR
+#define DLOOP_VOID_PTR_CAST_TO_OFFSET MPIU_VOID_PTR_CAST_TO_MPI_AINT
+#define DLOOP_PTR_DISP_CAST_TO_OFFSET MPIU_PTR_DISP_CAST_TO_MPI_AINT
 
 /* printing macros */
 #define DLOOP_OFFSET_FMT_DEC_SPEC MPI_AINT_FMT_DEC_SPEC
diff --git a/src/mpid/common/datatype/mpid_segment.c b/src/mpid/common/datatype/mpid_segment.c
index ef36cd9..027f47d 100644
--- a/src/mpid/common/datatype/mpid_segment.c
+++ b/src/mpid/common/datatype/mpid_segment.c
@@ -248,7 +248,7 @@ static int MPID_Segment_contig_pack_to_iov(DLOOP_Offset *blocks_p,
 	    paramp->u.pack_vector.vectorp[last_idx].DLOOP_VECTOR_LEN;
     }
 
-    MPIU_Ensure_Aint_fits_in_pointer((MPI_VOID_PTR_CAST_TO_MPI_AINT (bufp)) + rel_off);
+    MPIU_Ensure_Aint_fits_in_pointer((MPIU_VOID_PTR_CAST_TO_MPI_AINT (bufp)) + rel_off);
     if ((last_idx == paramp->u.pack_vector.length-1) &&
 	(last_end != ((char *) bufp + rel_off)))
     {
@@ -348,7 +348,7 @@ static int MPID_Segment_vector_pack_to_iov(DLOOP_Offset *blocks_p,
 		paramp->u.pack_vector.vectorp[last_idx].DLOOP_VECTOR_LEN;
 	}
 
-	MPIU_Ensure_Aint_fits_in_pointer((MPI_VOID_PTR_CAST_TO_MPI_AINT (bufp)) + rel_off);
+	MPIU_Ensure_Aint_fits_in_pointer((MPIU_VOID_PTR_CAST_TO_MPI_AINT (bufp)) + rel_off);
 	if ((last_idx == paramp->u.pack_vector.length-1) &&
 	    (last_end != ((char *) bufp + rel_off)))
 	{
@@ -422,13 +422,13 @@ static int MPID_Segment_contig_flatten(DLOOP_Offset *blocks_p,
 #ifdef MPID_SP_VERBOSE
     MPIU_dbg_printf("\t[contig flatten: idx = %d, loc = (" MPI_AINT_FMT_HEX_SPEC " + " MPI_AINT_FMT_HEX_SPEC ") = " MPI_AINT_FMT_HEX_SPEC ", size = " MPI_AINT_FMT_DEC_SPEC "]\n",
 		    idx,
-		    MPI_VOID_PTR_CAST_TO_MPI_AINT bufp,
+		    MPIU_VOID_PTR_CAST_TO_MPI_AINT bufp,
 		    (MPI_Aint) rel_off,
-		    MPI_VOID_PTR_CAST_TO_MPI_AINT bufp + rel_off,
+		    MPIU_VOID_PTR_CAST_TO_MPI_AINT bufp + rel_off,
 		    (MPI_Aint) size);
 #endif
 
-    if (idx > 0 && ((DLOOP_Offset) MPI_VOID_PTR_CAST_TO_MPI_AINT bufp + rel_off) ==
+    if (idx > 0 && ((DLOOP_Offset) MPIU_VOID_PTR_CAST_TO_MPI_AINT bufp + rel_off) ==
 	((paramp->u.flatten.offp[idx - 1]) +
 	 (DLOOP_Offset) paramp->u.flatten.sizep[idx - 1]))
     {
@@ -436,7 +436,7 @@ static int MPID_Segment_contig_flatten(DLOOP_Offset *blocks_p,
 	paramp->u.flatten.sizep[idx - 1] += size;
     }
     else {
-	paramp->u.flatten.offp[idx] =  ((int64_t) MPI_VOID_PTR_CAST_TO_MPI_AINT bufp) + (int64_t) rel_off;
+	paramp->u.flatten.offp[idx] =  ((int64_t) MPIU_VOID_PTR_CAST_TO_MPI_AINT bufp) + (int64_t) rel_off;
 	paramp->u.flatten.sizep[idx] = size;
 
 	paramp->u.flatten.index++;
@@ -499,7 +499,7 @@ static int MPID_Segment_vector_flatten(DLOOP_Offset *blocks_p,
 	    blocks_left = 0;
 	}
 
-	if (idx > 0 && ((DLOOP_Offset) MPI_VOID_PTR_CAST_TO_MPI_AINT bufp + rel_off) ==
+	if (idx > 0 && ((DLOOP_Offset) MPIU_VOID_PTR_CAST_TO_MPI_AINT bufp + rel_off) ==
 	    ((paramp->u.flatten.offp[idx - 1]) + (DLOOP_Offset) paramp->u.flatten.sizep[idx - 1]))
 	{
 	    /* add this size to the last region rather than using up another one */
@@ -507,7 +507,7 @@ static int MPID_Segment_vector_flatten(DLOOP_Offset *blocks_p,
 	}
 	else if (idx < paramp->u.flatten.length) {
 	    /* take up another region */
-	    paramp->u.flatten.offp[idx]  = (DLOOP_Offset) MPI_VOID_PTR_CAST_TO_MPI_AINT bufp + rel_off;
+	    paramp->u.flatten.offp[idx]  = (DLOOP_Offset) MPIU_VOID_PTR_CAST_TO_MPI_AINT bufp + rel_off;
 	    paramp->u.flatten.sizep[idx] = size;
 	    paramp->u.flatten.index++;
 	}
diff --git a/src/mpid/common/datatype/mpid_type_create_pairtype.c b/src/mpid/common/datatype/mpid_type_create_pairtype.c
index 2db382c..3c6fad8 100644
--- a/src/mpid/common/datatype/mpid_type_create_pairtype.c
+++ b/src/mpid/common/datatype/mpid_type_create_pairtype.c
@@ -20,7 +20,7 @@
 	type_size_   = sizeof(foo.a) + sizeof(foo.b);			\
 	type_extent_ = (MPI_Aint) sizeof(foo);				\
 	el_size_ = (sizeof(foo.a) == sizeof(foo.b)) ? (int) sizeof(foo.a) : -1; \
-	true_ub_ = (MPI_VOID_PTR_CAST_TO_MPI_AINT ((char *) &foo.b -     \
+	true_ub_ = (MPIU_VOID_PTR_CAST_TO_MPI_AINT ((char *) &foo.b -     \
                                                   (char *) &foo.a)) +   \
                   (MPI_Aint) sizeof(foo.b);                             \
 	alignsize_ = MPIR_MAX(MPID_Datatype_get_basic_size(mt1_),	\
diff --git a/src/mpid/pamid/src/coll/allgather/mpido_allgather.c b/src/mpid/pamid/src/coll/allgather/mpido_allgather.c
index 14104a2..8ef7b66 100644
--- a/src/mpid/pamid/src/coll/allgather/mpido_allgather.c
+++ b/src/mpid/pamid/src/coll/allgather/mpido_allgather.c
@@ -174,7 +174,7 @@ int MPIDO_Allgather_bcast(const void *sendbuf,
   np = comm_ptr ->local_size;
   MPID_Datatype_get_extent_macro(recvtype, extent);
 
-  MPIU_Ensure_Aint_fits_in_pointer ((MPI_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
+  MPIU_Ensure_Aint_fits_in_pointer ((MPIU_VOID_PTR_CAST_TO_MPI_AINT recvbuf +
 				     np * recvcount * extent));
   if (sendbuf != MPI_IN_PLACE)
   {
diff --git a/src/mpid/pamid/src/mpid_aint.c b/src/mpid/pamid/src/mpid_aint.c
index e331f57..39c50b9 100644
--- a/src/mpid/pamid/src/mpid_aint.c
+++ b/src/mpid/pamid/src/mpid_aint.c
@@ -27,7 +27,7 @@ MPI_Aint MPID_Aint_add(MPI_Aint base, MPI_Aint disp)
     MPIDI_STATE_DECL(MPID_STATE_MPID_AINT_ADD);
     MPIDI_FUNC_ENTER(MPID_STATE_MPID_AINT_ADD);
 
-    result =  MPI_VOID_PTR_CAST_TO_MPI_AINT ((char*)MPI_AINT_CAST_TO_VOID_PTR(base) + disp);
+    result =  MPIU_VOID_PTR_CAST_TO_MPI_AINT ((char*)MPIU_AINT_CAST_TO_VOID_PTR(base) + disp);
 
     MPIDI_FUNC_EXIT(MPID_STATE_MPID_AINT_ADD);
     return result;
@@ -54,7 +54,7 @@ MPI_Aint MPID_Aint_diff(MPI_Aint addr1, MPI_Aint addr2)
     MPIDI_STATE_DECL(MPID_STATE_MPID_AINT_DIFF);
     MPIDI_FUNC_ENTER(MPID_STATE_MPID_AINT_DIFF);
 
-    result =  MPI_PTR_DISP_CAST_TO_MPI_AINT ((char*)MPI_AINT_CAST_TO_VOID_PTR(addr1) - (char*)MPI_AINT_CAST_TO_VOID_PTR(addr2));
+    result =  MPIU_PTR_DISP_CAST_TO_MPI_AINT ((char*)MPIU_AINT_CAST_TO_VOID_PTR(addr1) - (char*)MPIU_AINT_CAST_TO_VOID_PTR(addr2));
 
     MPIDI_FUNC_EXIT(MPID_STATE_MPID_AINT_DIFF);
     return result;
diff --git a/src/util/pointer/mpiu_pointer.h b/src/util/pointer/mpiu_pointer.h
index df42b0b..e19d22b 100644
--- a/src/util/pointer/mpiu_pointer.h
+++ b/src/util/pointer/mpiu_pointer.h
@@ -53,7 +53,7 @@
  * \param[in]  aint  Variable of type MPI_Aint
  */
 #define MPIU_Ensure_Aint_fits_in_pointer(aint) \
-  MPIU_Assert((aint) == (MPI_Aint)(MPIU_Upint) MPI_AINT_CAST_TO_VOID_PTR(aint));
+  MPIU_Assert((aint) == (MPI_Aint)(MPIU_Upint) MPIU_AINT_CAST_TO_VOID_PTR(aint));
 
 
 #endif /* !defined(MPIU_POINTER_H_INCLUDED) */
diff --git a/src/util/type/mpiu_type_defs.h b/src/util/type/mpiu_type_defs.h
index 6126855..5c3bc01 100644
--- a/src/util/type/mpiu_type_defs.h
+++ b/src/util/type/mpiu_type_defs.h
@@ -86,9 +86,9 @@ typedef MPIU_SIZE_T MPIU_Size_t;
 
 /* Adding the 32-bit compute/64-bit I/O related type-casts in here as
  * they are not a part of the MPI standard yet. */
-#define MPI_AINT_CAST_TO_VOID_PTR (void *)(MPIU_Pint)
-#define MPI_VOID_PTR_CAST_TO_MPI_AINT (MPI_Aint)(MPIU_Upint)
-#define MPI_PTR_DISP_CAST_TO_MPI_AINT (MPI_Aint)(MPIU_Pint)
+#define MPIU_AINT_CAST_TO_VOID_PTR (void *)(MPIU_Pint)
+#define MPIU_VOID_PTR_CAST_TO_MPI_AINT (MPI_Aint)(MPIU_Upint)
+#define MPIU_PTR_DISP_CAST_TO_MPI_AINT (MPI_Aint)(MPIU_Pint)
 
 #define MPIU_CONTEXT_ID_T_DATATYPE MPI_UINT16_T
 typedef uint16_t MPIU_Context_id_t;

http://git.mpich.org/mpich.git/commitdiff/5f2cb148b330cfe2e46e22af8549c92e68e68de2

commit 5f2cb148b330cfe2e46e22af8549c92e68e68de2
Author: Charles J Archer <charles.j.archer at intel.com>
Date:   Fri Aug 14 09:01:57 2015 -0700

    MPIR_ERR_POP routines, remove if branch on error checking
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/include/mpierrs.h b/src/include/mpierrs.h
index 5c22f15..795e36d 100644
--- a/src/include/mpierrs.h
+++ b/src/include/mpierrs.h
@@ -625,6 +625,7 @@ cvars:
  *
  */
 /* --BEGIN ERROR MACROS-- */
+#ifdef HAVE_ERROR_CHECKING
 #define MPIR_ERR_POP(err_) \
     MPIR_ERR_SETANDSTMT(err_,MPI_ERR_OTHER,goto fn_fail,"**fail")
 #define MPIR_ERR_POP_LABEL(err_, label_) \
@@ -633,6 +634,12 @@ cvars:
     MPIR_ERR_SETFATALANDSTMT(err_,MPI_ERR_OTHER,goto fn_fail,"**fail")
 #define MPIR_ERR_POPFATAL_LABEL(err_, label_)                           \
     MPIR_ERR_SETFATALANDSTMT(err_,MPI_ERR_OTHER,goto label_,"**fail")
+#else
+#define MPIR_ERR_POP(err_) goto fn_fail
+#define MPIR_ERR_POP_LABEL(err_, label_) goto label_
+#define MPIR_ERR_POPFATAL(err_) goto fn_fail
+#define MPIR_ERR_POPFATAL_LABEL(err_, label_) goto label_
+#endif
 
 /* If you add any macros to this list, make sure that you update
  maint/extracterrmsgs to handle the additional macros (see the hash 

http://git.mpich.org/mpich.git/commitdiff/4a706ae7ad15a14f6a759d5df207f5e00d4138f3

commit 4a706ae7ad15a14f6a759d5df207f5e00d4138f3
Author: Pavan Balaji <balaji at anl.gov>
Date:   Fri Aug 14 11:18:12 2015 -0500

    Cleanup timer functionality.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/src/util/timers/mpiu_timer.c b/src/util/timers/mpiu_timer.c
index c0d72b7..bebd005 100644
--- a/src/util/timers/mpiu_timer.c
+++ b/src/util/timers/mpiu_timer.c
@@ -6,6 +6,38 @@
 
 #include "mpiu_timer.h"
 
+/*
+ * For timers that do not have defined resolutions, compute the resolution
+ * by sampling the clock itself.
+ *
+ */
+static double tickval = -1.0;
+
+static void init_wtick(void) ATTRIBUTE((unused));
+static void init_wtick(void)
+{
+    double timediff;
+    MPIU_Time_t t1, t2;
+    int cnt;
+    int icnt;
+
+    tickval = 1.0e6;
+    for (icnt = 0; icnt < 10; icnt++) {
+        cnt = 1000;
+        MPIU_Wtime(&t1);
+        do {
+            MPIU_Wtime(&t2);
+            MPIU_Wtime_diff(&t1, &t2, &timediff);
+            if (timediff > 0)
+                break;
+        }
+        while (cnt--);
+        if (cnt && timediff > 0.0 && timediff < tickval) {
+            MPIU_Wtime_diff(&t1, &t2, &tickval);
+        }
+    }
+}
+
 #if MPICH_TIMER_KIND == USE_GETHRTIME
 /*
  * MPIU_Time_t is hrtime_t, which under Solaris is defined as a 64bit
@@ -47,10 +79,10 @@ double MPIU_Wtick(void)
      * is untested */
     return 1.0e-9;
 }
-void MPIU_Init_wtick();
+
 int MPIU_Wtime_init(void)
 {
-    MPIU_Init_wtick();
+    init_wtick();
     return 0;
 }
 
@@ -86,9 +118,6 @@ void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
     }
 }
 
-/* FIXME: We need to cleanup the use of the MPIU_Generic_wtick prototype */
-double MPIU_Generic_wtick(void);
-
 double MPIU_Wtick(void)
 {
     struct timespec res;
@@ -100,19 +129,16 @@ double MPIU_Wtick(void)
         return res.tv_sec + 1.0e-9 * res.tv_nsec;
 
     /* Sigh.  If not implemented (POSIX allows that),
-     * then we need to use the generic tick routine */
-    return MPIU_Generic_wtick();
+     * then we need to return the generic tick value */
+    return tickval;
 }
-void MPIU_Init_wtick();
+
 int MPIU_Wtime_init(void)
 {
-    MPIU_Init_wtick();
+    init_wtick();
     return 0;
 }
 
-#define MPICH_NEEDS_GENERIC_WTICK
-/* Rename the function so that we can access it */
-#define MPIU_Wtick MPIU_Generic_wtick
 
 #elif MPICH_TIMER_KIND == USE_GETTIMEOFDAY
 #ifdef HAVE_SYS_TIME_H
@@ -151,7 +177,15 @@ void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
     }
 }
 
-#define MPICH_NEEDS_GENERIC_WTICK
+double MPIU_Wtick(void)
+{
+    return tickval;
+}
+
+int MPIU_Wtime_init(void)
+{
+    return 0;
+}
 
 
 #elif MPICH_TIMER_KIND == USE_LINUX86_CYCLE
@@ -200,6 +234,10 @@ void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
     *t3 += (*t2 - *t1);
 }
 
+double MPIU_Wtick(void)
+{
+    return tickval;
+}
 
 
 #elif MPICH_TIMER_KIND == USE_GCC_IA64_CYCLE
@@ -334,13 +372,13 @@ void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
 
 #elif MPICH_TIMER_KIND == USE_MACH_ABSOLUTE_TIME
 static double MPIR_Wtime_mult;
-void MPIU_Init_wtick();
+
 int MPIU_Wtime_init(void)
 {
     mach_timebase_info_data_t info;
     mach_timebase_info(&info);
     MPIR_Wtime_mult = 1.0e-9 * ((double) info.numer / (double) info.denom);
-    MPIU_Init_wtick();
+    init_wtick();
     return 0;
 }
 
@@ -364,59 +402,9 @@ void MPIU_Wtime_acc(MPIU_Time_t * t1, MPIU_Time_t * t2, MPIU_Time_t * t3)
     *t3 += *t2 - *t1;
 }
 
-/* FIXME: We need to cleanup the use of the MPIU_Generic_wtick prototype */
-double MPIU_Generic_wtick(void);
-
-double MPIU_Wtick(void)
-{
-    return MPIU_Generic_wtick();
-}
-
-#define MPICH_NEEDS_GENERIC_WTICK
-/* Rename the function so that we can access it */
-#define MPIU_Wtick MPIU_Generic_wtick
-
-
-#endif
-
-#ifdef MPICH_NEEDS_GENERIC_WTICK
-/*
- * For timers that do not have defined resolutions, compute the resolution
- * by sampling the clock itself.
- *
- */
-static double tickval = -1.0;
-
-void MPIU_Init_wtick(void)
-{
-    double timediff;
-    MPIU_Time_t t1, t2;
-    int cnt;
-    int icnt;
-
-    tickval = 1.0e6;
-    for (icnt = 0; icnt < 10; icnt++) {
-        cnt = 1000;
-        MPIU_Wtime(&t1);
-        do {
-            MPIU_Wtime(&t2);
-            MPIU_Wtime_diff(&t1, &t2, &timediff);
-            if (timediff > 0)
-                break;
-        }
-        while (cnt--);
-        if (cnt && timediff > 0.0 && timediff < tickval) {
-            MPIU_Wtime_diff(&t1, &t2, &tickval);
-        }
-    }
-}
-
-#undef FUNCNAME
-#define FUNCNAME MPIU_Wtick
-#undef FCNAME
-#define FCNAME MPL_QUOTE(FUNCNAME)
 double MPIU_Wtick(void)
 {
     return tickval;
 }
+
 #endif
diff --git a/src/util/timers/mpiu_timer.h.in b/src/util/timers/mpiu_timer.h.in
index d101880..a0ad428 100644
--- a/src/util/timers/mpiu_timer.h.in
+++ b/src/util/timers/mpiu_timer.h.in
@@ -8,6 +8,8 @@
 
 #include "mpichconf.h"
 #include <stdlib.h>
+#include "mpl.h"
+
 /*
  * This include file provide the definitions that are necessary to use the
  * timer calls, including the definition of the time stamp type and

http://git.mpich.org/mpich.git/commitdiff/05a87d2a5f7043ca879da13d3ac4876218e01c38

commit 05a87d2a5f7043ca879da13d3ac4876218e01c38
Author: Charles J Archer <charles.j.archer at intel.com>
Date:   Fri Aug 7 12:18:06 2015 -0700

    Second round of code refactoring
    
    Includes MPID->MPIU and MPIU->MPIR cleanup in appropriate places.
    Removes unused macros.  Moves thread functionality to src/util.
    
    Also, remove lock mode for ref counting.  We should never use locks
    for ref counting.  We either use straight load/store or incr/decr
    (when the lock is already held) or do OPA atomics if there is no lock
    held.  If OPA does not have native atomics for a platform, it will
    internally do the lock/unlock based atomic emulation anyway.
    
    Cleanup the per-object threading to pass actual mutexes.
    
    Signed-off-by: Ken Raffenetti <raffenet at mcs.anl.gov>

diff --git a/.gitignore b/.gitignore
index 5c25ece..bb70b76 100644
--- a/.gitignore
+++ b/.gitignore
@@ -473,7 +473,6 @@ Makefile.am-stamp
 # /src/include/
 /src/include/mpi.h
 /src/include/mpif.h
-/src/include/mpichtimer.h
 #/src/include/mpe_thread.h
 /src/include/mpimod.pcl
 /src/include/mpid_datatype.h
@@ -530,9 +529,6 @@ Makefile.am-stamp
 
 # /src/mpi/spawn/
 
-# /src/mpi/timer/
-/src/mpi/timer/mpichtimer.h
-
 # /src/mpid/ch3/channels/nemesis/nemesis/src/
 /src/mpid/ch3/channels/nemesis/src/mpid_nem_net_array.c
 
@@ -578,6 +574,9 @@ Makefile.am-stamp
 /src/util/logging/rlog/irlog2rlog
 /src/util/logging/rlog/trace_impl.h
 
+# /src/util/timers
+/src/util/timers/mpiu_timer.h
+
 # /test/
 /test/runtests
 
diff --git a/configure.ac b/configure.ac
index 6959e1a..f5953f0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -513,11 +513,11 @@ AC_ARG_ENABLE(refcount,
 	AC_HELP_STRING([--enable-refcount=type],
 			[Choose the method for ensuring atomic updates
                          to the reference counts for MPI objects.
-                         Values may be lock, lock-free, none.  The
+                         Values may be lock-free or none.  The
                          default depends on the thread-cs choice; for
                          global it is none (because none is required),
-                         for per-object it is lock, and for lock-free
-                         it is lock-free]),,enable_refcount=default)
+                         for per-object and lock-free, lock-free]),,
+                         enable_refcount=default)
 
 AC_ARG_ENABLE(mutex-timing,
 	AC_HELP_STRING([--enable-mutex-timing], [calculate the time spent waiting on mutexes]),
@@ -1349,6 +1349,10 @@ fi
 export MPICH_THREAD_LEVEL
 AC_DEFINE_UNQUOTED(MPICH_THREAD_LEVEL,$MPICH_THREAD_LEVEL,[Level of thread support selected at compile time])
 
+if test "$MPICH_THREAD_LEVEL" = "MPI_THREAD_MULTIPLE" ; then
+   AC_DEFINE([MPICH_IS_THREADED],[1],[MPICH is configured to require thread safety])
+fi
+
 # If not in MPI_THREAD_SINGLE, we need -D_REENTRANT to get thread-safe "errno".
 # Most POSIX systems provide this by default when using -lpthread, but we only use it in MPI_THREAD_MULTIPLE.
 # Some systems (Solaris) still require an explicit define in any case.
@@ -1357,23 +1361,20 @@ if test "$MPICH_THREAD_LEVEL" != "MPI_THREAD_SINGLE"; then
 fi
 
 # Check for value thread_cs choice; set the refcount default if necessary
-thread_granularity=MPIU_THREAD_GRANULARITY_SINGLE
+thread_granularity=MPIR_THREAD_GRANULARITY_SINGLE
 thread_refcount=MPIU_REFCOUNT_NONE
 if test "$enable_threads" = "multiple" ; then
     case $enable_thread_cs in 
     global)
-    thread_granularity=MPIU_THREAD_GRANULARITY_GLOBAL
+    thread_granularity=MPIR_THREAD_GRANULARITY_GLOBAL
     if test "$enable_refcount" = "default" ; then enable_refcount=none ; fi
     ;;
-    brief-global|brief_global)
-    AC_MSG_ERROR([--enable-thread-cs=brief-global is no longer supported, please select a different granularity])
-    ;;
     per-object|per_object)
-    thread_granularity=MPIU_THREAD_GRANULARITY_PER_OBJECT
-    if test "$enable_refcount" = "default" ; then enable_refcount=lock ; fi
+    thread_granularity=MPIR_THREAD_GRANULARITY_PER_OBJECT
+    if test "$enable_refcount" = "default" ; then enable_refcount=lock-free ; fi
     ;;
     lock-free|lock_free|lockfree)
-    thread_granularity=MPIU_THREAD_GRANULARITY_LOCK_FREE
+    thread_granularity=MPIR_THREAD_GRANULARITY_LOCK_FREE
     if test "$enable_refcount" = "default" ; then enable_refcount=lock-free ; fi
     if test "$enable_predefined_refcount" = "default" ; then enable_predefined_refcount=no ; fi
     AC_MSG_ERROR([--enable-thread-cs=lock-free is not supported yet, please select a different granularity])
@@ -1384,9 +1385,6 @@ if test "$enable_threads" = "multiple" ; then
     esac
 
     case $enable_refcount in
-    lock)
-    thread_refcount=MPIU_REFCOUNT_LOCK
-    ;;
     lock-free|lock_free|lockfree)
     thread_refcount=MPIU_REFCOUNT_LOCKFREE
     ;;
@@ -1398,7 +1396,7 @@ if test "$enable_threads" = "multiple" ; then
     ;;
     esac
 fi
-AC_DEFINE_UNQUOTED([MPIU_THREAD_GRANULARITY],$thread_granularity,[Method used to implement atomic updates and access])
+AC_DEFINE_UNQUOTED([MPICH_THREAD_GRANULARITY],$thread_granularity,[Method used to implement atomic updates and access])
 
 if test "$enable_predefined_refcount" = "no" ; then
     AC_DEFINE([MPIU_THREAD_SUPPRESS_PREDEFINED_REFCOUNTS],[1],[define to disable reference counting predefined objects like MPI_COMM_WORLD])
@@ -1512,9 +1510,6 @@ if test -n "$perform_memtracing" ; then
         AC_DEFINE(MPICH_DEBUG_MEMARENA,1,[Define if each function exit should confirm memory arena correctness])
     fi
 fi
-if test -n "$perform_mutexnesting" ; then 
-    AC_DEFINE(MPICH_DEBUG_MUTEXNESTING,1,[Define to check nesting in mutexes])
-fi
 USE_DBG_LOGGING=0
 if test -n "$perform_dbglog" ; then
    if test "$with_logging" != "none" ; then
@@ -2356,6 +2351,18 @@ fi
 export modincdir
 AC_SUBST(modincdir)
 
+AC_LANG_PUSH([C])
+AC_MSG_CHECKING([whether TRUE has been defined])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[return TRUE;])],
+                  [has_true_upper_case=yes],
+	          [has_true_upper_case=no])
+AC_MSG_RESULT($has_true_upper_case)
+if test "$has_true_upper_case" = "no" ; then
+   AC_DEFINE(TRUE,1,[Define TRUE])
+   AC_DEFINE(FALSE,0,[Define FALSE])
+fi
+AC_LANG_POP([C])
+
 # ----------------------------------------------------------------------------
 # We previously allowed "default" as a valid value for $enable_cxx.  Now we
 # assume its available by default and error out if it doesn't work (just like
@@ -4699,7 +4706,7 @@ fi
 # Support for timers.  The following code processes the 
 #  --enable-timer-type=name argument and selects the timer based on 
 # both that field and what configure is able to determine is available.
-# The file src/include/mpichtimer.h is also created.
+# The file src/include/mpiu_timer.h is also created.
 # Note that at least the handling of the "device" option must come *after* 
 # the setup_device script is loaded so that the device can set the appropriate
 # fields.  For now, we've split this so that there is an update to the timer
@@ -4708,8 +4715,8 @@ fi
 # FIXME DJG setup_device has been eliminated in favor of subconfigure.m4 files
 # ----------------------------------------------------------------------------
 # Default type for timer stamp.
-MPID_TIMER_TYPE=long
-AC_SUBST(MPID_TIMER_TYPE)
+MPICH_TIMER_TYPE=long
+AC_SUBST(MPICH_TIMER_TYPE)
 
 # If the device specified a timer type, use that by default.  Else,
 # try to detect a type that works on this system.
@@ -4796,7 +4803,7 @@ fi
 case "$timer_type" in
 
     gethrtime)
-    MPID_TIMER_TYPE=hrtime_t
+    MPICH_TIMER_TYPE=hrtime_t
     AC_CHECK_FUNC(gethrtime,,[
          AC_MSG_ERROR([Requested timer gethrtime is not available])
 ])
@@ -4806,7 +4813,7 @@ case "$timer_type" in
     missing_function=no
     AC_SEARCH_LIBS([clock_gettime],[rt],,AC_MSG_ERROR([clock_gettime is not available]))
     AC_SEARCH_LIBS([clock_getres],[rt],,AC_MSG_ERROR([clock_getres is not available]))
-    MPID_TIMER_TYPE="struct timespec"
+    MPICH_TIMER_TYPE="struct timespec"
     # AIX does not always define struct timespec (!)
     # Make sure that we can use struct timespec
     AC_CACHE_CHECK([whether struct timespec is defined in time.h],
@@ -4862,7 +4869,7 @@ pac_cv_posix_clock_realtime=no)
     ;;
 
     gettimeofday)
-    MPID_TIMER_TYPE="struct timeval"
+    MPICH_TIMER_TYPE="struct timeval"
     # We may have already tested for gettimeofday.  If we got a "yes",
     # we're good to go
     if test "$ac_cv_func_gettimeofday" != "yes" ; then
@@ -4966,7 +4973,7 @@ dnl platform.
     if test "$cpu_gcc_x86_cycle" = "no" ; then
         AC_MSG_ERROR([Linux86 cycle counter is not available on this system and or with the $CC compiler])
     fi
-    MPID_TIMER_TYPE="long long"
+    MPICH_TIMER_TYPE="long long"
     ;;
 
     gcc_ia64_cycle)
@@ -4984,7 +4991,7 @@ pac_cv_ia64_cycle,[
     if test "$pac_cv_gcc_ia64_cycle" != "yes" ; then
         AC_MSG_ERROR([IPF cycle counter is not available on this system and or with the $CC compiler])
      fi
-     MPID_TIMER_TYPE="long"
+     MPICH_TIMER_TYPE="long"
      ;;
 
     linuxalpha_cycle)
@@ -4994,14 +5001,14 @@ pac_cv_ia64_cycle,[
     mach_absolute_time)
     AC_CHECK_FUNC(mach_absolute_time,,[AC_MSG_ERROR([mach_absolute_time is not available])])
     AC_CHECK_FUNC(mach_timebase_info,,[AC_MSG_ERROR([mach_timebase_info is not available])])
-    MPID_TIMER_TYPE="uint64_t"
+    MPICH_TIMER_TYPE="uint64_t"
     ;;
 
     device)
     # The device selected should export the datatype for the timer
     # in MPID_DEVICE_TIMER_TYPE if something other than long is needed
     if test -n "$MPID_DEVICE_TIMER_TYPE" ; then
-       MPID_TIMER_TYPE=$MPID_DEVICE_TIMER_TYPE
+       MPICH_TIMER_TYPE=$MPID_DEVICE_TIMER_TYPE
     fi
     ;;
 
@@ -5202,7 +5209,7 @@ if test "$timer_type" = "DEVICE" ; then
     # The device selected should export the datatype for the timer
     # in MPID_DEVICE_TIMER_TYPE if something other than long is needed
     if test -n "$MPID_DEVICE_TIMER_TYPE" ; then 
-       MPID_TIMER_TYPE=$MPID_DEVICE_TIMER_TYPE
+       MPICH_TIMER_TYPE=$MPID_DEVICE_TIMER_TYPE
     fi
 fi
 
@@ -6198,7 +6205,6 @@ AC_OUTPUT(Makefile \
           src/include/mpichinfo.h \
 	  mpich-doxygen \
           src/include/glue_romio.h \
-          src/include/mpichtimer.h \
           src/binding/cxx/mpicxx.h \
 	  src/binding/fortran/mpif_h/mpif.h \
 	  src/binding/fortran/mpif_h/setbotf.f \
@@ -6221,6 +6227,7 @@ AC_OUTPUT(Makefile \
 	  src/env/mpifort.bash \
           src/env/parkill \
 	  src/util/dbg/getfuncstack \
+	  src/util/timers/mpiu_timer.h \
           src/include/mpi.h \
           doc/design/Makefile \
           doc/installguide/Makefile \
diff --git a/maint/Makefile.mk b/maint/Makefile.mk
index caf4fe1..83a9572 100644
--- a/maint/Makefile.mk
+++ b/maint/Makefile.mk
@@ -48,7 +48,6 @@ dist_noinst_DATA +=                        \
     maint/mpi1.lst                         \
     maint/setup.jpg                        \
     maint/structalign.c                    \
-    maint/template.c                       \
     maint/version.m4
 
 ### TODO FIXME what do we do about these?
diff --git a/maint/extractcvars.in b/maint/extractcvars.in
index bb2eca3..b21b688 100755
--- a/maint/extractcvars.in
+++ b/maint/extractcvars.in
@@ -226,7 +226,7 @@ print OUTPUT_C <<EOT;
 #undef FUNCNAME
 #define FUNCNAME ${fn_ns}_init
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int ${fn_ns}_init(void)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -328,19 +328,19 @@ EOT
         if ($p->{type} eq 'range') {
 print OUTPUT_C <<EOT;
     rc = MPL_env2${env_fn}("$env_name", &($var_name.low), &($var_name.high));
-    MPIU_ERR_CHKANDJUMP1((-1 == rc),mpi_errno,MPI_ERR_OTHER,"**envvarparse","**envvarparse %s","$env_name");
+    MPIR_ERR_CHKANDJUMP1((-1 == rc),mpi_errno,MPI_ERR_OTHER,"**envvarparse","**envvarparse %s","$env_name");
 EOT
         }
         elsif ($p->{type} eq 'string') {
 print OUTPUT_C <<EOT;
     rc = MPL_env2${env_fn}("$env_name", &tmp_str);
-    MPIU_ERR_CHKANDJUMP1((-1 == rc),mpi_errno,MPI_ERR_OTHER,"**envvarparse","**envvarparse %s","$env_name");
+    MPIR_ERR_CHKANDJUMP1((-1 == rc),mpi_errno,MPI_ERR_OTHER,"**envvarparse","**envvarparse %s","$env_name");
 EOT
         }
         else {
 print OUTPUT_C <<EOT;
     rc = MPL_env2${env_fn}("$env_name", &($var_name));
-    MPIU_ERR_CHKANDJUMP1((-1 == rc),mpi_errno,MPI_ERR_OTHER,"**envvarparse","**envvarparse %s","$env_name");
+    MPIR_ERR_CHKANDJUMP1((-1 == rc),mpi_errno,MPI_ERR_OTHER,"**envvarparse","**envvarparse %s","$env_name");
 EOT
         }
     }
diff --git a/maint/extracterrmsgs b/maint/extracterrmsgs
index 5fe997e..b22954b 100755
--- a/maint/extracterrmsgs
+++ b/maint/extracterrmsgs
@@ -623,10 +623,10 @@ sub ProcessFile
 	# Match the known routines and macros.
 	# Then check that the arguments match if there is a 
 	# specific string (number of args matches the number present)
-        # MPIU_ERR_CHK(FATAL)?ANDJUMP[1-4]?(cond,code,class,gmsg[,smsg,args])
-        # MPIU_ERR_SET(FATAL)?ANDJUMP[1-4]?(code,class,gmsg[,smsg,args])
-	# MPIU_ERR_CHK(FATAL)?ANDSTMT[1-4]?(cond,code,class,stmt,gmsg[,smsg,args])
-	# MPIU_ERR_SET(FATAL)?ANDSTMT[1-4]?(code,class,stmt,gmsg[,smsg,args])
+        # MPIR_ERR_CHK(FATAL)?ANDJUMP[1-4]?(cond,code,class,gmsg[,smsg,args])
+        # MPIR_ERR_SET(FATAL)?ANDJUMP[1-4]?(code,class,gmsg[,smsg,args])
+	# MPIR_ERR_CHK(FATAL)?ANDSTMT[1-4]?(cond,code,class,stmt,gmsg[,smsg,args])
+	# MPIR_ERR_SET(FATAL)?ANDSTMT[1-4]?(code,class,stmt,gmsg[,smsg,args])
 	# Value is a tuple of:
 	#  the count of args where the generic msg begins (starting from 0)
 	#  location of __LINE__ (-1 for none)
@@ -635,54 +635,54 @@ sub ProcessFile
 	#  location of the error class
 	%KnownErrRoutines = ( 'MPIR_Err_create_code'      => '5:3:1:1:4', 
 			      'MPIO_Err_create_code'      => '5:3:1:0:-1', 
-			      'MPIU_ERR_SET'              => '2:-1:0:1:1',
-			      'MPIU_ERR_SETSIMPLE'        => '2:-1:0:1:1',
-			      'MPIU_ERR_SET1'             => '2:-1:1:1:1',
-			      'MPIU_ERR_SET2'             => '2:-1:2:1:1',
-			      'MPIU_ERR_SETANDSTMT'       => '3:-1:0:1:1',
-			      'MPIU_ERR_SETANDSTMT1'      => '3:-1:1:1:1', 
-			      'MPIU_ERR_SETANDSTMT2'      => '3:-1:1:1:1', 
-			      'MPIU_ERR_SETANDSTMT3'      => '3:-1:1:1:1', 
-			      'MPIU_ERR_SETANDSTMT4'      => '3:-1:1:1:1', 
-			      'MPIU_ERR_SETANDJUMP'       => '2:-1:0:1:1',
-			      'MPIU_ERR_SETANDJUMP1'      => '2:-1:1:1:1', 
-			      'MPIU_ERR_SETANDJUMP2'      => '2:-1:1:1:1', 
-			      'MPIU_ERR_SETANDJUMP3'      => '2:-1:1:1:1', 
-			      'MPIU_ERR_SETANDJUMP4'      => '2:-1:1:1:1', 
-			      'MPIU_ERR_CHKANDSTMT'       => '4:-1:0:1:2', 
-			      'MPIU_ERR_CHKANDSTMT1'      => '4:-1:1:1:2', 
-			      'MPIU_ERR_CHKANDSTMT2'      => '4:-1:1:1:2', 
-			      'MPIU_ERR_CHKANDSTMT3'      => '4:-1:1:1:2', 
-			      'MPIU_ERR_CHKANDSTMT4'      => '4:-1:1:1:2', 
-			      'MPIU_ERR_CHKANDJUMP'       => '3:-1:0:1:2',
-			      'MPIU_ERR_CHKANDJUMP1'      => '3:-1:1:1:2',
-			      'MPIU_ERR_CHKANDJUMP2'      => '3:-1:1:1:2',
-			      'MPIU_ERR_CHKANDJUMP3'      => '3:-1:1:1:2',
-			      'MPIU_ERR_CHKANDJUMP4'      => '3:-1:1:1:2',
-			      'MPIU_ERR_SETFATAL'         => '2:-1:0:1:1',
-			      'MPIU_ERR_SETFATALSIMPLE'   => '2:-1:0:1:1',
-			      'MPIU_ERR_SETFATAL1'        => '2:-1:1:1:1',
-			      'MPIU_ERR_SETFATAL2'        => '2:-1:2:1:1',
-			      'MPIU_ERR_SETFATALANDSTMT'  => '3:-1:0:1:1',
-			      'MPIU_ERR_SETFATALANDSTMT1' => '3:-1:1:1:1', 
-			      'MPIU_ERR_SETFATALANDSTMT2' => '3:-1:1:1:1', 
-			      'MPIU_ERR_SETFATALANDSTMT3' => '3:-1:1:1:1', 
-			      'MPIU_ERR_SETFATALANDSTMT4' => '3:-1:1:1:1', 
-			      'MPIU_ERR_SETFATALANDJUMP'  => '2:-1:0:1:1',
-			      'MPIU_ERR_SETFATALANDJUMP1' => '2:-1:1:1:1', 
-			      'MPIU_ERR_SETFATALANDJUMP2' => '2:-1:1:1:1', 
-			      'MPIU_ERR_SETFATALANDJUMP3' => '2:-1:1:1:1', 
-			      'MPIU_ERR_SETFATALANDJUMP4' => '2:-1:1:1:1', 
-			      'MPIU_ERR_CHKFATALANDSTMT'  => '4:-1:0:1:2', 
-			      'MPIU_ERR_CHKFATALANDSTMT1' => '4:-1:1:1:2', 
-			      'MPIU_ERR_CHKFATALANDSTMT2' => '4:-1:1:1:2', 
-			      'MPIU_ERR_CHKFATALANDSTMT3' => '4:-1:1:1:2', 
-			      'MPIU_ERR_CHKFATALANDSTMT4' => '4:-1:1:1:2', 
-			      'MPIU_ERR_CHKFATALANDJUMP'  => '3:-1:0:1:2',
-			      'MPIU_ERR_CHKFATALANDJUMP1' => '3:-1:1:1:2',
-			      'MPIU_ERR_CHKFATALANDJUMP2' => '3:-1:1:1:2',
-			      'MPIU_ERR_CHKFATALANDJUMP3' => '3:-1:1:1:2',
-			      'MPIU_ERR_CHKFATALANDJUMP4' => '3:-1:1:1:2',
+			      'MPIR_ERR_SET'              => '2:-1:0:1:1',
+			      'MPIR_ERR_SETSIMPLE'        => '2:-1:0:1:1',
+			      'MPIR_ERR_SET1'             => '2:-1:1:1:1',
+			      'MPIR_ERR_SET2'             => '2:-1:2:1:1',
+			      'MPIR_ERR_SETANDSTMT'       => '3:-1:0:1:1',
+			      'MPIR_ERR_SETANDSTMT1'      => '3:-1:1:1:1', 
+			      'MPIR_ERR_SETANDSTMT2'      => '3:-1:1:1:1', 
+			      'MPIR_ERR_SETANDSTMT3'      => '3:-1:1:1:1', 
+			      'MPIR_ERR_SETANDSTMT4'      => '3:-1:1:1:1', 
+			      'MPIR_ERR_SETANDJUMP'       => '2:-1:0:1:1',
+			      'MPIR_ERR_SETANDJUMP1'      => '2:-1:1:1:1', 
+			      'MPIR_ERR_SETANDJUMP2'      => '2:-1:1:1:1', 
+			      'MPIR_ERR_SETANDJUMP3'      => '2:-1:1:1:1', 
+			      'MPIR_ERR_SETANDJUMP4'      => '2:-1:1:1:1', 
+			      'MPIR_ERR_CHKANDSTMT'       => '4:-1:0:1:2', 
+			      'MPIR_ERR_CHKANDSTMT1'      => '4:-1:1:1:2', 
+			      'MPIR_ERR_CHKANDSTMT2'      => '4:-1:1:1:2', 
+			      'MPIR_ERR_CHKANDSTMT3'      => '4:-1:1:1:2', 
+			      'MPIR_ERR_CHKANDSTMT4'      => '4:-1:1:1:2', 
+			      'MPIR_ERR_CHKANDJUMP'       => '3:-1:0:1:2',
+			      'MPIR_ERR_CHKANDJUMP1'      => '3:-1:1:1:2',
+			      'MPIR_ERR_CHKANDJUMP2'      => '3:-1:1:1:2',
+			      'MPIR_ERR_CHKANDJUMP3'      => '3:-1:1:1:2',
+			      'MPIR_ERR_CHKANDJUMP4'      => '3:-1:1:1:2',
+			      'MPIR_ERR_SETFATAL'         => '2:-1:0:1:1',
+			      'MPIR_ERR_SETFATALSIMPLE'   => '2:-1:0:1:1',
+			      'MPIR_ERR_SETFATAL1'        => '2:-1:1:1:1',
+			      'MPIR_ERR_SETFATAL2'        => '2:-1:2:1:1',
+			      'MPIR_ERR_SETFATALANDSTMT'  => '3:-1:0:1:1',
+			      'MPIR_ERR_SETFATALANDSTMT1' => '3:-1:1:1:1', 
+			      'MPIR_ERR_SETFATALANDSTMT2' => '3:-1:1:1:1', 
+			      'MPIR_ERR_SETFATALANDSTMT3' => '3:-1:1:1:1', 
+			      'MPIR_ERR_SETFATALANDSTMT4' => '3:-1:1:1:1', 
+			      'MPIR_ERR_SETFATALANDJUMP'  => '2:-1:0:1:1',
+			      'MPIR_ERR_SETFATALANDJUMP1' => '2:-1:1:1:1', 
+			      'MPIR_ERR_SETFATALANDJUMP2' => '2:-1:1:1:1', 
+			      'MPIR_ERR_SETFATALANDJUMP3' => '2:-1:1:1:1', 
+			      'MPIR_ERR_SETFATALANDJUMP4' => '2:-1:1:1:1', 
+			      'MPIR_ERR_CHKFATALANDSTMT'  => '4:-1:0:1:2', 
+			      'MPIR_ERR_CHKFATALANDSTMT1' => '4:-1:1:1:2', 
+			      'MPIR_ERR_CHKFATALANDSTMT2' => '4:-1:1:1:2', 
+			      'MPIR_ERR_CHKFATALANDSTMT3' => '4:-1:1:1:2', 
+			      'MPIR_ERR_CHKFATALANDSTMT4' => '4:-1:1:1:2', 
+			      'MPIR_ERR_CHKFATALANDJUMP'  => '3:-1:0:1:2',
+			      'MPIR_ERR_CHKFATALANDJUMP1' => '3:-1:1:1:2',
+			      'MPIR_ERR_CHKFATALANDJUMP2' => '3:-1:1:1:2',
+			      'MPIR_ERR_CHKFATALANDJUMP3' => '3:-1:1:1:2',
+			      'MPIR_ERR_CHKFATALANDJUMP4' => '3:-1:1:1:2',
 			      'MPIR_ERRTEST_VALID_HANDLE' => '4:-1:0:1:3',
 			      );
 	while (/(MPI[OUR]_E[A-Za-z0-9_]+)\s*(\(.*)$/) {
diff --git a/maint/getcoverage.in b/maint/getcoverage.in
index 904fcd3..9eb7239 100644
--- a/maint/getcoverage.in
+++ b/maint/getcoverage.in
@@ -288,13 +288,13 @@ L:  while (<FD>) {
 	}
 
 	# If requested, skip obvious error checking lines
-	# The errflag set should really be an MPIU_ERR macro; the
+	# The errflag set should really be an MPIR_ERR macro; the
 	# test is designed to accept only lines that set that flag
 	# and nothing else.
 	if ($skipErrExits && 
 	    (/FUNC_EXIT.*STATE/ || /MPIR_Err_return_/ || 
-	     /MPIU_ERR_SET/ || /MPIU_ERR_POP/ || /goto\s+fn_fail/ ||
-	     /MPIU_ERR_ADD/ || /\*errflag\s*=\s*[^;]*;\s*$/ || 
+	     /MPIR_ERR_SET/ || /MPIR_ERR_POP/ || /goto\s+fn_fail/ ||
+	     /MPIR_ERR_ADD/ || /\*errflag\s*=\s*[^;]*;\s*$/ || 
 	     /fn_fail:/ || /MPIR_Err_create_code/)) {
 	    next;
 	}
@@ -408,8 +408,8 @@ L2: while (<FD>) {
 	# The format of the line also changed
 	if ($skipErrExits && 
 	    (/FUNC_EXIT.*STATE/ || /MPIR_Err_return_/ || 
-	     /MPIU_ERR_SET/ || /MPIU_ERR_POP/ || /goto\s+fn_fail/ ||
-	     /MPIU_ERR_ADD/ || /\*errflag\s*=\s*[^;]*;\s*$/ || 
+	     /MPIR_ERR_SET/ || /MPIR_ERR_POP/ || /goto\s+fn_fail/ ||
+	     /MPIR_ERR_ADD/ || /\*errflag\s*=\s*[^;]*;\s*$/ || 
             /fn_fail:/ || /MPIR_Err_create_code/)) {
 	    # If requested, skip obvious error checking lines
 	    $newstate = "skip";
diff --git a/maint/template.c b/maint/template.c
deleted file mode 100644
index 945aaf1..0000000
--- a/maint/template.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
-/*
- *  (C) 2001 by Argonne National Laboratory.
- *      See COPYRIGHT in top-level directory.
- */
-
-#include "mpiimpl.h"
-
-/* -- Begin Profiling Symbol Block for routine MPI_Foo */
-#if defined(HAVE_PRAGMA_WEAK)
-#pragma weak MPI_Foo = PMPI_Foo
-#elif defined(HAVE_PRAGMA_HP_SEC_DEF)
-#pragma _HP_SECONDARY_DEF PMPI_Foo  MPI_Foo
-#elif defined(HAVE_PRAGMA_CRI_DUP)
-#pragma _CRI duplicate MPI_Foo as PMPI_Foo
-#endif
-/* -- End Profiling Symbol Block */
-
-/* Define MPICH_MPI_FROM_PMPI if weak symbols are not supported to build
-   the MPI routines.  You can use USE_WEAK_SYMBOLS to see if MPICH is
-   using weak symbols to implement the MPI routines. */
-#ifndef MPICH_MPI_FROM_PMPI
-/* The PMPI routine is built using a CPP macro to rename the MPI routine
-   implemented below.  The MPI name must be undefined first to prevent any
-   conflicts with previous renamings. */
-#undef MPI_Foo
-#define MPI_Foo PMPI_Foo
-
-/* Any internal routines can go here.  Make them static if possible.  If they
-   are used by both the MPI and PMPI versions, use PMPI_LOCAL instead of 
-   static; this macro expands into "static" if weak symbols are supported and
-   into nothing otherwise. */
-int MPIR_Foo_util( int a, MPID_Comm *comm )
-{
-...
-}
-#endif
-
-#undef FUNCNAME
-#define FUNCNAME MPI_Foo
-
-/*@
-   MPI_Foo - short description
-
-   Input Arguments:
-+  first - 
-.  middle - 
--  last - 
-
-   Output Arguments:
-
-   Notes:
-
-.N Fortran
-
-.N Errors
-.N MPI_SUCCESS
-.N ... others
-@*/
-int MPI_Foo( MPI_Comm comm, MPI_Datatype dataype, int a ) 
-{
-    static const char FCNAME[] = "MPI_Foo";
-    int mpi_errno = MPI_SUCCESS;
-    MPID_Comm *comm_ptr = NULL;
-    MPID_MPI_STATE_DECL(MPID_STATE_MPI_FOO);
-
-    MPIR_ERRTEST_INITIALIZED_ORDIE();
-    
-    MPIU_THREAD_CS_ENTER(ALLFUNC);
-    MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_FOO);
-
-    /* Validate handle parameters needing to be converted */
-#   ifdef HAVE_ERROR_CHECKING
-    {
-        MPID_BEGIN_ERROR_CHECKS;
-        {
-	    MPIR_ERRTEST_COMM(comm, mpi_errno);
-            if (mpi_errno) goto fn_fail;
-	}
-        MPID_END_ERROR_CHECKS;
-    }
-#   endif /* HAVE_ERROR_CHECKING */
-    
-    /* Convert handles to MPI objects. */
-    MPID_Comm_get_ptr( comm, comm_ptr );
-    
-#   ifdef HAVE_ERROR_CHECKING
-    {
-        MPID_BEGIN_ERROR_CHECKS;
-        {
-            MPID_Datatype *datatype_ptr = NULL;
-
-            /* Validate comm_ptr */
-            MPID_Comm_valid_ptr( comm_ptr, mpi_errno );
-	    /* If comm_ptr is not valid, it will be reset to null */
-            if (mpi_errno) goto fn_fail;
-
-            if (HANDLE_GET_KIND(datatype) != HANDLE_KIND_BUILTIN)
-	    {
-                MPID_Datatype_get_ptr(datatype, datatype_ptr);
-                MPID_Datatype_valid_ptr( datatype_ptr, mpi_errno );
-                if (mpi_errno != MPI_SUCCESS) goto fn_fail;
-            }
-        }
-        MPID_END_ERROR_CHECKS;
-    }
-#   endif /* HAVE_ERROR_CHECKING */
-
-    /* ... body of routine ...  */
-    
-    /* ... end of body of routine ... */
-
-  fn_exit:
-    MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_FOO);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
-    return mpi_errno;
-
-  fn_fail:
-    /* --BEGIN ERROR HANDLING-- */
-#   ifdef HAVE_ERROR_CHECKING
-    {
-	mpi_errno = MPIR_Err_create_code(
-	    mpi_errno, MPIR_ERR_RECOVERABLE, FCNAME, __LINE__, 
-	    MPI_ERR_OTHER, "**mpi_foo",
-	    "**mpi_foo %C %D %d", comm, datatype, a);
-    }
-#   endif
-    mpi_errno = MPIR_Err_return_comm( comm_ptr, FCNAME, mpi_errno );
-    goto fn_exit;
-    /* --END ERROR HANDLING-- */
-}
diff --git a/src/binding/fortran/mpif_h/buildiface b/src/binding/fortran/mpif_h/buildiface
index d644d58..9f5d95f 100755
--- a/src/binding/fortran/mpif_h/buildiface
+++ b/src/binding/fortran/mpif_h/buildiface
@@ -4283,17 +4283,14 @@ sub build_specials {
     &set_weak_decl( "MPI_Wtime", "void", "double" );
     &set_weak_decl( "PMPI_Wtime", "void", "double" );
     &print_header( "mpi_", "MPI_Wtime", "wtime", "" );
-    # mpichtimer.h is needed for the timer definitions
+    # mpiu_timer.h is needed for the timer definitions
     print $OUTFD "#include \"mpichconf.h\"\n";
-    print $OUTFD "#include \"mpichtimer.h\"\n";
+    print $OUTFD "#include \"mpiu_timer.h\"\n";
     &print_routine_type_decl( $OUTFD, $out_prefix, "wtime" );
     print $OUTFD "( void ) ";
     #&print_attr;
     print $OUTFD "{\n";
-    print $OUTFD "    double d; MPID_Time_t t;\n
-    MPID_Wtime( &t );
-    MPID_Wtime_todouble( &t, &d );
-    return d;\n";
+    print $OUTFD "return MPI_Wtime();\n";
     print $OUTFD "}\n";
     close ($OUTFD);
     &ReplaceIfDifferent( $filename, $filename . ".new" );
@@ -4315,16 +4312,14 @@ sub build_specials {
     &set_weak_decl( "MPI_Wtick", "void", "double" );
     &set_weak_decl( "PMPI_Wtick", "void", "double" );
     &print_header( "mpi_", "MPI_Wtick", "wtick", "" );
-    # mpichtimer.h is needed for the timer definitions
+    # mpiu_timer.h is needed for the timer definitions
     print $OUTFD "#include \"mpichconf.h\"\n";
-    print $OUTFD "#include \"mpichtimer.h\"\n";
+    print $OUTFD "#include \"mpiu_timer.h\"\n";
     &print_routine_type_decl( $OUTFD, $out_prefix, "wtick" );
     print $OUTFD "( void ) ";
     #&print_attr;
     print $OUTFD "{\n";
-    print $OUTFD "    double d; 
-    d = MPID_Wtick( );
-    return d;\n";
+    print $OUTFD "return MPI_Wtick();\n";
     print $OUTFD "}\n";
     close ($OUTFD);
     &ReplaceIfDifferent( $filename, $filename . ".new" );
diff --git a/src/binding/fortran/use_mpi/create_f90_complex.c b/src/binding/fortran/use_mpi/create_f90_complex.c
index c002da4..b65e7cb 100644
--- a/src/binding/fortran/use_mpi/create_f90_complex.c
+++ b/src/binding/fortran/use_mpi/create_f90_complex.c
@@ -80,7 +80,7 @@ int MPI_Type_create_f90_complex( int precision, int range, MPI_Datatype *newtype
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_F90_COMPLEX);
 
     /* ... body of routine ...  */
@@ -95,7 +95,7 @@ int MPI_Type_create_f90_complex( int precision, int range, MPI_Datatype *newtype
 					    f90_real_model[i].digits, 
 					    f90_real_model[i].exponent, 
 					    &f90_real_model[i].dtype );
-	    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+	    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	}
     }
 
@@ -120,13 +120,13 @@ int MPI_Type_create_f90_complex( int precision, int range, MPI_Datatype *newtype
 	mpi_errno = MPIR_Create_unnamed_predefined( basetype, 
 		    MPI_COMBINER_F90_COMPLEX, range, precision, newtype );
 	}
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	
     /* ... end of body of routine ... */
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_F90_COMPLEX);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 fn_fail:
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/binding/fortran/use_mpi/create_f90_int.c b/src/binding/fortran/use_mpi/create_f90_int.c
index 4dd7c8c..f2a8ad9 100644
--- a/src/binding/fortran/use_mpi/create_f90_int.c
+++ b/src/binding/fortran/use_mpi/create_f90_int.c
@@ -74,7 +74,7 @@ int MPI_Type_create_f90_integer( int range, MPI_Datatype *newtype )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_F90_INTEGER);
 
     /* ... body of routine ...  */
@@ -109,7 +109,7 @@ int MPI_Type_create_f90_integer( int range, MPI_Datatype *newtype )
     /* ... end of body of routine ... */
  fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_F90_INTEGER);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
  fn_fail:
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/binding/fortran/use_mpi/create_f90_real.c b/src/binding/fortran/use_mpi/create_f90_real.c
index a21e810..5e3a68f 100644
--- a/src/binding/fortran/use_mpi/create_f90_real.c
+++ b/src/binding/fortran/use_mpi/create_f90_real.c
@@ -79,7 +79,7 @@ int MPI_Type_create_f90_real( int precision, int range, MPI_Datatype *newtype )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_F90_REAL);
 
     /* ... body of routine ...  */
@@ -94,7 +94,7 @@ int MPI_Type_create_f90_real( int precision, int range, MPI_Datatype *newtype )
 					    f90_real_model[i].digits, 
 					    f90_real_model[i].exponent, 
 					    &f90_real_model[i].dtype );
-	    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+	    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	}
     }
 
@@ -119,11 +119,11 @@ int MPI_Type_create_f90_real( int precision, int range, MPI_Datatype *newtype )
 	mpi_errno = MPIR_Create_unnamed_predefined( basetype, 
 			    MPI_COMBINER_F90_REAL, range, precision, newtype );
     }
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     /* ... end of body of routine ... */
 
  fn_exit:
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_F90_REAL);
     return mpi_errno;
  fn_fail:
diff --git a/src/binding/fortran/use_mpi/create_f90_util.c b/src/binding/fortran/use_mpi/create_f90_util.c
index 956a118..0749891 100644
--- a/src/binding/fortran/use_mpi/create_f90_util.c
+++ b/src/binding/fortran/use_mpi/create_f90_util.c
@@ -36,7 +36,7 @@ static int MPIR_FreeF90Datatypes( void *d )
 #undef FUNCNAME
 #define FUNCNAME MPIR_Create_unnamed_predefined
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Create_unnamed_predefined( MPI_Datatype old, int combiner, 
 				    int r, int p, 
 				    MPI_Datatype *new_ptr )
@@ -76,7 +76,7 @@ int MPIR_Create_unnamed_predefined( MPI_Datatype old, int combiner,
 
     /* Create a contiguous type from one instance of the named type */
     mpi_errno = MPID_Type_contiguous( 1, old, &type->d );
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* Initialize the contents data */
     {
@@ -102,7 +102,7 @@ int MPIR_Create_unnamed_predefined( MPI_Datatype old, int combiner,
 	mpi_errno = MPID_Datatype_set_contents(new_dtp, combiner,
 					       nvals, 0, 0, vals,
 					       NULL, NULL );
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         /* FIXME should we be setting type->is_permanent=TRUE here too?  If so,
          * will the cleanup code handle it correctly and not freak out? */
@@ -123,7 +123,7 @@ int MPIR_Create_unnamed_predefined( MPI_Datatype old, int combiner,
         /* the MPI Standard requires that these types are pre-committed
          * (MPI-2.2, sec 16.2.5, pg 492) */
         mpi_errno = MPID_Type_commit(&type->d);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     *new_ptr       = type->d;
diff --git a/src/binding/fortran/use_mpi_f08/wrappers_c/comm_spawn_multiple_c.c b/src/binding/fortran/use_mpi_f08/wrappers_c/comm_spawn_multiple_c.c
index 5e07e57..b7ab98c 100644
--- a/src/binding/fortran/use_mpi_f08/wrappers_c/comm_spawn_multiple_c.c
+++ b/src/binding/fortran/use_mpi_f08/wrappers_c/comm_spawn_multiple_c.c
@@ -4,7 +4,7 @@
 #undef FUNCNAME
 #define FUNCNAME MPIR_Comm_spawn_multiple_c
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Comm_spawn_multiple_c(int count, char* array_of_commands_f,
              char* array_of_argv_f, const int* array_of_maxprocs,
              const MPI_Info* array_of_info, int root, MPI_Comm comm,
@@ -49,12 +49,12 @@ int MPIR_Comm_spawn_multiple_c(int count, char* array_of_commands_f,
         array_of_argv_c = MPI_ARGVS_NULL;
     } else {
         array_of_argv_c = (char***) MPIU_Malloc(sizeof(char**)*count);
-        if (!array_of_argv_c) MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**nomem");
+        if (!array_of_argv_c) MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**nomem");
 
         /* Allocate a temp buf to put args of a command */
         len = 256; /* length of buf. Initialized with an arbitrary value */
         buf = (char*)MPIU_Malloc(sizeof(char)*len);
-        if (!buf) MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**nomem");
+        if (!buf) MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**nomem");
 
         for (i = 0; i < count; i++) {
             /* Extract args of command i, and put them in buf */
@@ -67,7 +67,7 @@ int MPIR_Comm_spawn_multiple_c(int count, char* array_of_commands_f,
                     newbuf = (char*)MPIU_Realloc(buf, len);
                     if (!newbuf) {
                         MPIU_Free(buf);
-                        MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**nomem");
+                        MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**nomem");
                     }
                     buf = newbuf;
                 }
diff --git a/src/binding/fortran/use_mpi_f08/wrappers_c/utils.c b/src/binding/fortran/use_mpi_f08/wrappers_c/utils.c
index 3e1e629..4d0e112 100644
--- a/src/binding/fortran/use_mpi_f08/wrappers_c/utils.c
+++ b/src/binding/fortran/use_mpi_f08/wrappers_c/utils.c
@@ -24,7 +24,7 @@
 #undef FUNCNAME
 #define FUNCNAME MPIR_Fortran_array_of_string_f2c
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 extern int MPIR_Fortran_array_of_string_f2c(const char* strs_f, char*** strs_c, int str_len, int know_size, int size)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -53,7 +53,7 @@ extern int MPIR_Fortran_array_of_string_f2c(const char* strs_f, char*** strs_c,
     /* Allocate memory for pointers to strings and the strings themself */
     buf = (char*) MPIU_Malloc(sizeof(char*) * num_strs + sizeof(char) * (num_chars + num_strs)); /* Add \0 for each string */
     if (buf == NULL) {
-        MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**nomem");
+        MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**nomem");
     }
 
     *strs_c = (char**)buf;
diff --git a/src/glue/romio/glue_romio.c b/src/glue/romio/glue_romio.c
index 9b64992..0c8c5f6 100644
--- a/src/glue/romio/glue_romio.c
+++ b/src/glue/romio/glue_romio.c
@@ -35,50 +35,50 @@ int MPIR_Ext_assert_fail(const char *cond, const char *file_name, int line_num)
     return MPIR_Assert_fail(cond, file_name, line_num);
 }
 
-/* These two routines export the ALLFUNC CS_ENTER/EXIT macros as functions so
+/* These two routines export the GLOBAL CS_ENTER/EXIT macros as functions so
  * that ROMIO can use them.  These routines only support the GLOBAL granularity
  * of MPICH threading; other accommodations must be made for finer-grained
  * threading strategies. */
-void MPIR_Ext_cs_enter_allfunc(void)
+void MPIR_Ext_cs_enter_global(void)
 {
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
 }
 
-void MPIR_Ext_cs_exit_allfunc(void)
+void MPIR_Ext_cs_exit_global(void)
 {
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
 }
 
 /* This routine is for a thread to yield control when the thread is waiting for
  * the completion of communication inside a ROMIO routine but the progress
  * engine is blocked by another thread. */
-void MPIR_Ext_cs_yield_allfunc_if_progress_blocked(void)
+void MPIR_Ext_cs_yield_global_if_progress_blocked(void)
 {
     /* TODO: check whether the progress engine is blocked */
-    MPIU_THREAD_CS_YIELD(ALLFUNC,);
+    MPID_THREAD_CS_YIELD(GLOBAL, MPIR_ThreadInfo.global_mutex);
 }
 
 /* will consider MPI_DATATYPE_NULL to be an error */
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ext_datatype_iscommitted
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ext_datatype_iscommitted(MPI_Datatype datatype)
 {
     int mpi_errno = MPI_SUCCESS;
 
     MPIR_ERRTEST_DATATYPE(datatype, "datatype", mpi_errno);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     if (HANDLE_GET_KIND(datatype) != HANDLE_KIND_BUILTIN) {
         MPID_Datatype *datatype_ptr = NULL;
         MPID_Datatype_get_ptr(datatype, datatype_ptr);
 
         MPID_Datatype_valid_ptr(datatype_ptr, mpi_errno);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         MPID_Datatype_committed_ptr(datatype_ptr, mpi_errno);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
 fn_fail:
diff --git a/src/include/Makefile.mk b/src/include/Makefile.mk
index 23a11ab..4c2eb76 100644
--- a/src/include/Makefile.mk
+++ b/src/include/Makefile.mk
@@ -14,8 +14,7 @@ nodist_include_HEADERS += src/include/mpi.h
 nodist_noinst_HEADERS +=     \
     src/include/glue_romio.h \
     src/include/mpichinfo.h \
-    src/include/mpichconf.h  \
-    src/include/mpichtimer.h
+    src/include/mpichconf.h
 
 ## listed here in BUILT_SOURCES to ensure that if glue_romio.h is out of date
 ## that it will be rebuilt before make recurses into src/mpi/romio and runs
@@ -39,8 +38,6 @@ noinst_HEADERS +=                   \
     src/include/mpifunc.h           \
     src/include/mpihandlemem.h      \
     src/include/mpiimpl.h           \
-    src/include/mpiimplthread.h     \
-    src/include/mpiimplthreadpost.h \
     src/include/mpimem.h            \
     src/include/mpir_nbc.h          \
     src/include/mpir_type_defs.h    \
diff --git a/src/include/glue_romio.h.in b/src/include/glue_romio.h.in
index 5f61016..d4d859d 100644
--- a/src/include/glue_romio.h.in
+++ b/src/include/glue_romio.h.in
@@ -51,9 +51,9 @@ extern int MPIR_Ext_dbg_romio_verbose_enabled;
  * glue code that cannot be initialized statically */
 int MPIR_Ext_init(void);
 
-void MPIR_Ext_cs_enter_allfunc(void);
-void MPIR_Ext_cs_exit_allfunc(void);
-void MPIR_Ext_cs_yield_allfunc_if_progress_blocked(void);
+void MPIR_Ext_cs_enter_global(void);
+void MPIR_Ext_cs_exit_global(void);
+void MPIR_Ext_cs_yield_global_if_progress_blocked(void);
 
 /* to facilitate error checking */
 int MPIR_Ext_datatype_iscommitted(MPI_Datatype datatype);
diff --git a/src/include/mpichconfconst.h b/src/include/mpichconfconst.h
index 8f4e2da..946a8de 100644
--- a/src/include/mpichconfconst.h
+++ b/src/include/mpichconfconst.h
@@ -26,16 +26,15 @@
 /* Define the four ways that we achieve proper thread-safe updates of
  * shared structures and services
  *
- * A configure choice will set MPIU_THREAD_GRANULARITY to one of these values */
+ * A configure choice will set MPICH_THREAD_GRANULARITY to one of these values */
 
 /* _INVALID exists to avoid accidental macro evaluations to 0 */
-#define MPIU_THREAD_GRANULARITY_INVALID 0
-#define MPIU_THREAD_GRANULARITY_GLOBAL 1
-#define MPIU_THREAD_GRANULARITY_BRIEF_GLOBAL 2
-#define MPIU_THREAD_GRANULARITY_PER_OBJECT 3
-#define MPIU_THREAD_GRANULARITY_LOCK_FREE 4
+#define MPIR_THREAD_GRANULARITY_INVALID 0
+#define MPIR_THREAD_GRANULARITY_GLOBAL 1
+#define MPIR_THREAD_GRANULARITY_PER_OBJECT 2
+#define MPIR_THREAD_GRANULARITY_LOCK_FREE 3
 /* _SINGLE is the "null" granularity, where all processes are single-threaded */
-#define MPIU_THREAD_GRANULARITY_SINGLE 5
+#define MPIR_THREAD_GRANULARITY_SINGLE 4
 
 /* controls the allocation mechanism for MPID_Request handles, which can greatly
  * affect concurrency on the critical path */
@@ -46,7 +45,6 @@
 #define MPIU_REFCOUNT_INVALID 0
 /* _NONE means no concurrency control, such as when using MPI_THREAD_SINGLE */
 #define MPIU_REFCOUNT_NONE 1
-#define MPIU_REFCOUNT_LOCK 2
-#define MPIU_REFCOUNT_LOCKFREE 3
+#define MPIU_REFCOUNT_LOCKFREE 2
 
 #endif /* MPICHCONFCONST_H_INCLUDED */
diff --git a/src/include/mpierrs.h b/src/include/mpierrs.h
index cf7ed3c..5c22f15 100644
--- a/src/include/mpierrs.h
+++ b/src/include/mpierrs.h
@@ -265,7 +265,7 @@ cvars:
 #define MPIR_ERRTEST_WIN_FLAVOR(win_, flavor_, err_)                    \
     do {                                                                \
         if ((win_)->create_flavor != (flavor_)) {                       \
-            MPIU_ERR_SETANDSTMT1((err_), MPI_ERR_RMA_FLAVOR,            \
+            MPIR_ERR_SETANDSTMT1((err_), MPI_ERR_RMA_FLAVOR,            \
                                 goto fn_fail, "**winflavor",            \
                                  "**winflavor %s", #flavor_);           \
         }                                                               \
@@ -295,7 +295,7 @@ cvars:
 #define MPIR_ERRTEST_NAMED_BUF_INPLACE(buf, bufname, count, err)       \
     do {                                                               \
         if (count > 0 && buf == MPI_IN_PLACE) {                        \
-            MPIU_ERR_SETANDJUMP1(err, MPI_ERR_BUFFER, "**buf_inplace", \
+            MPIR_ERR_SETANDJUMP1(err, MPI_ERR_BUFFER, "**buf_inplace", \
                                  "**buf_inplace %s", bufname);         \
         }                                                              \
     } while (0)
@@ -346,7 +346,7 @@ cvars:
 #define MPIR_ERRTEST_VALID_HANDLE(handle_,kind_,err_,errclass_,gmsg_) { \
         if (HANDLE_GET_MPI_KIND(handle_) != kind_ ||                    \
             HANDLE_GET_KIND(handle_) == HANDLE_KIND_INVALID) {          \
-            MPIU_ERR_SETANDSTMT(err_,errclass_,goto fn_fail,gmsg_);     \
+            MPIR_ERR_SETANDSTMT(err_,errclass_,goto fn_fail,gmsg_);     \
         }                                                               \
     }
 /* --END ERROR MACROS-- */
@@ -354,10 +354,10 @@ cvars:
 #define MPIR_ERRTEST_OP(op,err)                                                 \
     do {                                                                        \
         if (op == MPI_OP_NULL) {                                                \
-            MPIU_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnull");        \
+            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnull");        \
         }                                                                       \
         else if (op == MPI_NO_OP || op == MPI_REPLACE) {                        \
-            MPIU_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnotallowed");  \
+            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnotallowed");  \
         }                                                                       \
         else {                                                                  \
             MPIR_ERRTEST_VALID_HANDLE(op,MPID_OP,err,MPI_ERR_OP,"**op");        \
@@ -367,35 +367,35 @@ cvars:
 #define MPIR_ERRTEST_OP_ACC(op,err)                                             \
     do {                                                                        \
         if (op == MPI_OP_NULL) {                                                \
-            MPIU_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnull");        \
+            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnull");        \
         }                                                                       \
         else if (op == MPI_NO_OP) {                                             \
-            MPIU_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnotallowed");  \
+            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnotallowed");  \
         }                                                                       \
         else {                                                                  \
             MPIR_ERRTEST_VALID_HANDLE(op,MPID_OP,err,MPI_ERR_OP,"**op");        \
         }                                                                       \
         if (HANDLE_GET_KIND(op) != HANDLE_KIND_BUILTIN) {                       \
-            MPIU_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnotpredefined"); \
+            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnotpredefined"); \
         }                                                                       \
     } while (0)
 
 #define MPIR_ERRTEST_OP_GACC(op,err)                                            \
     do {                                                                        \
         if (op == MPI_OP_NULL) {                                                \
-            MPIU_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnull");        \
+            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnull");        \
         }                                                                       \
         else {                                                                  \
             MPIR_ERRTEST_VALID_HANDLE(op,MPID_OP,err,MPI_ERR_OP,"**op");        \
         }                                                                       \
         if (HANDLE_GET_KIND(op) != HANDLE_KIND_BUILTIN) {                       \
-            MPIU_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnotpredefined"); \
+            MPIR_ERR_SETANDSTMT(err,MPI_ERR_OP,goto fn_fail,"**opnotpredefined"); \
         }                                                                       \
     } while (0)
 
 #define MPIR_ERRTEST_GROUP(group,err)                                   \
     if (group == MPI_GROUP_NULL) {                                      \
-        MPIU_ERR_SETANDSTMT(err,MPI_ERR_GROUP,goto fn_fail,"**groupnull"); \
+        MPIR_ERR_SETANDSTMT(err,MPI_ERR_GROUP,goto fn_fail,"**groupnull"); \
     }                                                                   \
     else {                                                              \
         MPIR_ERRTEST_VALID_HANDLE(group,MPID_GROUP,err,MPI_ERR_GROUP,"**group"); \
@@ -405,7 +405,7 @@ cvars:
     {									\
         if ((comm_) == MPI_COMM_NULL)					\
         {                                                               \
-            MPIU_ERR_SETANDSTMT((err_), MPI_ERR_COMM,goto fn_fail,"**commnull"); \
+            MPIR_ERR_SETANDSTMT((err_), MPI_ERR_COMM,goto fn_fail,"**commnull"); \
         }                                                               \
         else								\
         {                                                               \
@@ -417,7 +417,7 @@ cvars:
     {									\
         if ((win_) == MPI_WIN_NULL)                                     \
         {                                                               \
-            MPIU_ERR_SETANDSTMT((err_), MPI_ERR_WIN,goto fn_fail, "**winnull"); \
+            MPIR_ERR_SETANDSTMT((err_), MPI_ERR_WIN,goto fn_fail, "**winnull"); \
         }                                                               \
         else								\
         {                                                               \
@@ -429,7 +429,7 @@ cvars:
     {									\
         if ((request_) == MPI_REQUEST_NULL)                             \
         {                                                               \
-            MPIU_ERR_SETANDSTMT((err_), MPI_ERR_REQUEST,goto fn_fail, "**requestnull"); \
+            MPIR_ERR_SETANDSTMT((err_), MPI_ERR_REQUEST,goto fn_fail, "**requestnull"); \
         }                                                               \
         else								\
         {                                                               \
@@ -451,12 +451,12 @@ cvars:
         if ((request_) != MPI_REQUEST_NULL)                             \
         {                                                               \
             if (HANDLE_GET_MPI_KIND(request_) != MPID_REQUEST) {        \
-                MPIU_ERR_SETANDSTMT2(err_,MPI_ERR_REQUEST,goto fn_fail, \
+                MPIR_ERR_SETANDSTMT2(err_,MPI_ERR_REQUEST,goto fn_fail, \
                                      "**request_invalid_kind","**request_invalid_kind %d %d", \
                                      i_, HANDLE_GET_MPI_KIND(request_)); \
             }                                                           \
             else if (HANDLE_GET_KIND(request_) == HANDLE_KIND_INVALID) { \
-                MPIU_ERR_SETANDSTMT1(err_,MPI_ERR_REQUEST,goto fn_fail, \
+                MPIR_ERR_SETANDSTMT1(err_,MPI_ERR_REQUEST,goto fn_fail, \
                                      "**request","**request %d", i_ );  \
             }                                                           \
         }                                                               \
@@ -464,7 +464,7 @@ cvars:
 
 #define MPIR_ERRTEST_ERRHANDLER(errhandler_,err_)			\
     if (errhandler_ == MPI_ERRHANDLER_NULL) {				\
-        MPIU_ERR_SETANDSTMT(err_,MPI_ERR_ARG,goto fn_fail,"**errhandlernull"); \
+        MPIR_ERR_SETANDSTMT(err_,MPI_ERR_ARG,goto fn_fail,"**errhandlernull"); \
     }									\
     else {								\
         MPIR_ERRTEST_VALID_HANDLE(errhandler_,MPID_ERRHANDLER,		\
@@ -475,7 +475,7 @@ cvars:
     {									\
         if ((info_) == MPI_INFO_NULL)					\
         {                                                               \
-            MPIU_ERR_SETANDSTMT(err_, MPI_ERR_ARG,goto fn_fail, "**infonull"); \
+            MPIR_ERR_SETANDSTMT(err_, MPI_ERR_ARG,goto fn_fail, "**infonull"); \
         }                                                               \
         else								\
         {                                                               \
@@ -495,15 +495,15 @@ cvars:
     {									\
         if ((keyval_) == MPI_KEYVAL_INVALID)				\
         {                                                               \
-            MPIU_ERR_SETANDSTMT(err_, MPI_ERR_KEYVAL,goto fn_fail, "**keyvalinvalid"); \
+            MPIR_ERR_SETANDSTMT(err_, MPI_ERR_KEYVAL,goto fn_fail, "**keyvalinvalid"); \
         }                                                               \
         else if (HANDLE_GET_MPI_KIND(keyval_) != MPID_KEYVAL)		\
         {                                                               \
-            MPIU_ERR_SETANDSTMT(err_, MPI_ERR_KEYVAL,goto fn_fail, "**keyval"); \
+            MPIR_ERR_SETANDSTMT(err_, MPI_ERR_KEYVAL,goto fn_fail, "**keyval"); \
         }                                                               \
         else if ((((keyval_) & 0x03c00000) >> 22) != (object_))		\
         {                                                               \
-            MPIU_ERR_SETANDSTMT1(err_, MPI_ERR_KEYVAL,goto fn_fail, "**keyvalobj", \
+            MPIR_ERR_SETANDSTMT1(err_, MPI_ERR_KEYVAL,goto fn_fail, "**keyvalobj", \
                                  "**keyvalobj %s", (objectdesc_));      \
         }                                                               \
     }
@@ -513,7 +513,7 @@ cvars:
         if (HANDLE_GET_MPI_KIND(keyval_) == MPID_KEYVAL &&              \
             HANDLE_GET_KIND(keyval_) == HANDLE_KIND_BUILTIN)		\
         {                                                               \
-            MPIU_ERR_SETANDSTMT(err_, MPI_ERR_KEYVAL,goto fn_fail, "**permattr"); \
+            MPIR_ERR_SETANDSTMT(err_, MPI_ERR_KEYVAL,goto fn_fail, "**permattr"); \
         }                                                               \
     }
 
@@ -521,7 +521,7 @@ cvars:
 #define MPIR_ERRTEST_MPIT_INITIALIZED(err_) \
     do { \
         if (!MPIR_T_is_initialized()) { \
-            MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_NOT_INITIALIZED, goto fn_fail, "**mpitinit"); \
+            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_NOT_INITIALIZED, goto fn_fail, "**mpitinit"); \
         } \
     } while (0)
 #else
@@ -532,7 +532,7 @@ cvars:
     do {   \
         if ((index_) < 0 || (index_) >= utarray_len(cat_table)) \
         {  \
-            MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_INDEX, goto fn_fail, "**catindex");  \
+            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_INDEX, goto fn_fail, "**catindex");  \
         }  \
     } while (0)
 
@@ -540,11 +540,11 @@ cvars:
     do {   \
         if ((handle_) == MPI_T_ENUM_NULL)  \
         {  \
-            MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**enumhandlenull");  \
+            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**enumhandlenull");  \
         }  \
         else if ((handle_)->kind != MPIR_T_ENUM_HANDLE) \
         {  \
-            MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**enumhandle"); \
+            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**enumhandle"); \
         }  \
     } while (0)
 
@@ -552,7 +552,7 @@ cvars:
     do {   \
         if ((index_) < 0 || (index_) >= utarray_len((enum_)->items)) \
         {  \
-            MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_ITEM, goto fn_fail, "**itemindex");  \
+            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_ITEM, goto fn_fail, "**itemindex");  \
         }  \
     } while (0)
 
@@ -560,7 +560,7 @@ cvars:
     do {   \
         if ((index_) < 0 || (index_) >= utarray_len(cvar_table)) \
         {  \
-            MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_INDEX, goto fn_fail, "**cvarindex");  \
+            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_INDEX, goto fn_fail, "**cvarindex");  \
         }  \
     } while (0)
 
@@ -568,11 +568,11 @@ cvars:
     do {   \
         if ((handle_) == MPI_T_CVAR_HANDLE_NULL)  \
         {  \
-            MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**cvarhandlenull");  \
+            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**cvarhandlenull");  \
         }  \
         else if ((handle_)->kind != MPIR_T_CVAR_HANDLE) \
         {  \
-            MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**cvarhandle"); \
+            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**cvarhandle"); \
         }  \
     } while (0)
 
@@ -580,7 +580,7 @@ cvars:
     do {   \
         if ((index_) < 0 || (index_) >= utarray_len(pvar_table)) \
         {  \
-            MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_INDEX, goto fn_fail, "**pvarindex");  \
+            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_INDEX, goto fn_fail, "**pvarindex");  \
         }  \
     } while (0)
 
@@ -588,11 +588,11 @@ cvars:
     do {   \
         if (handle_ == MPI_T_PVAR_HANDLE_NULL) \
         {  \
-            MPIU_ERR_SETANDSTMT(err_,MPI_T_ERR_INVALID_HANDLE, goto fn_fail,"**pvarhandlenull"); \
+            MPIR_ERR_SETANDSTMT(err_,MPI_T_ERR_INVALID_HANDLE, goto fn_fail,"**pvarhandlenull"); \
         }  \
         else if ((handle_)->kind != MPIR_T_PVAR_HANDLE)  \
         {  \
-            MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**pvarhandle");  \
+            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_HANDLE, goto fn_fail, "**pvarhandle");  \
         }  \
     } while (0)
 
@@ -600,19 +600,19 @@ cvars:
     do {    \
         if ((session_) == MPI_T_PVAR_SESSION_NULL)  \
         {   \
-            MPIU_ERR_SETANDSTMT(err_,MPI_T_ERR_INVALID_SESSION, goto fn_fail,"**pvarsessionnull");  \
+            MPIR_ERR_SETANDSTMT(err_,MPI_T_ERR_INVALID_SESSION, goto fn_fail,"**pvarsessionnull");  \
         }   \
         else if ((session_)->kind != MPIR_T_PVAR_SESSION) \
         {   \
-            MPIU_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_SESSION, goto fn_fail, "**pvarsession");  \
+            MPIR_ERR_SETANDSTMT(err_, MPI_T_ERR_INVALID_SESSION, goto fn_fail, "**pvarsession");  \
         }   \
     } while (0)
 
 /* some simple memcpy aliasing checks */
-#define MPIU_ERR_CHKMEMCPYANDSTMT(err_,stmt_,src_,dst_,len_) \
-    MPIU_ERR_CHKANDSTMT3(MPIU_MEM_RANGES_OVERLAP((dst_),(len_),(src_),(len_)),err_,MPI_ERR_INTERN,stmt_,"**memcpyalias","**memcpyalias %p %p %L",(src_),(dst_),(long long)(len_))
-#define MPIU_ERR_CHKMEMCPYANDJUMP(err_,src_,dst_,len_) \
-    MPIU_ERR_CHKMEMCPYANDSTMT((err_),goto fn_fail,(src_),(dst_),(len_))
+#define MPIR_ERR_CHKMEMCPYANDSTMT(err_,stmt_,src_,dst_,len_) \
+    MPIR_ERR_CHKANDSTMT3(MPIU_MEM_RANGES_OVERLAP((dst_),(len_),(src_),(len_)),err_,MPI_ERR_INTERN,stmt_,"**memcpyalias","**memcpyalias %p %p %L",(src_),(dst_),(long long)(len_))
+#define MPIR_ERR_CHKMEMCPYANDJUMP(err_,src_,dst_,len_) \
+    MPIR_ERR_CHKMEMCPYANDSTMT((err_),goto fn_fail,(src_),(dst_),(len_))
 
 /* Special MPI error "class/code" for out of memory */
 /* FIXME: not yet done */
@@ -625,14 +625,14 @@ cvars:
  *
  */
 /* --BEGIN ERROR MACROS-- */
-#define MPIU_ERR_POP(err_) \
-    MPIU_ERR_SETANDSTMT(err_,MPI_ERR_OTHER,goto fn_fail,"**fail")
-#define MPIU_ERR_POP_LABEL(err_, label_) \
-    MPIU_ERR_SETANDSTMT(err_,MPI_ERR_OTHER,goto label_,"**fail")
-#define MPIU_ERR_POPFATAL(err_) \
-    MPIU_ERR_SETFATALANDSTMT(err_,MPI_ERR_OTHER,goto fn_fail,"**fail")
-#define MPIU_ERR_POPFATAL_LABEL(err_, label_)                           \
-    MPIU_ERR_SETFATALANDSTMT(err_,MPI_ERR_OTHER,goto label_,"**fail")
+#define MPIR_ERR_POP(err_) \
+    MPIR_ERR_SETANDSTMT(err_,MPI_ERR_OTHER,goto fn_fail,"**fail")
+#define MPIR_ERR_POP_LABEL(err_, label_) \
+    MPIR_ERR_SETANDSTMT(err_,MPI_ERR_OTHER,goto label_,"**fail")
+#define MPIR_ERR_POPFATAL(err_) \
+    MPIR_ERR_SETFATALANDSTMT(err_,MPI_ERR_OTHER,goto fn_fail,"**fail")
+#define MPIR_ERR_POPFATAL_LABEL(err_, label_)                           \
+    MPIR_ERR_SETFATALANDSTMT(err_,MPI_ERR_OTHER,goto label_,"**fail")
 
 /* If you add any macros to this list, make sure that you update
  maint/extracterrmsgs to handle the additional macros (see the hash 
@@ -643,184 +643,184 @@ cvars:
  first argument to MPIR_Err_create_code .
 */
 #ifdef HAVE_ERROR_CHECKING
-#define MPIU_ERR_SETSIMPLE(err_,class_,msg_)	\
+#define MPIR_ERR_SETSIMPLE(err_,class_,msg_)	\
     err_ = MPIR_Err_create_code( MPI_SUCCESS,MPIR_ERR_RECOVERABLE,FCNAME,\
            __LINE__, class_, msg_, 0 )
-#define MPIU_ERR_SET(err_,class_,msg_) \
+#define MPIR_ERR_SET(err_,class_,msg_) \
     err_ = MPIR_Err_create_code( err_,MPIR_ERR_RECOVERABLE,FCNAME,\
            __LINE__, class_, msg_, 0 )
-#define MPIU_ERR_SET1(err_,class_,gmsg_,smsg_,arg1_) \
+#define MPIR_ERR_SET1(err_,class_,gmsg_,smsg_,arg1_) \
     err_ = MPIR_Err_create_code( err_,MPIR_ERR_RECOVERABLE,FCNAME,\
            __LINE__, class_, gmsg_, smsg_, arg1_ )
-#define MPIU_ERR_SET2(err_,class_,gmsg_,smsg_,arg1_,arg2_) \
+#define MPIR_ERR_SET2(err_,class_,gmsg_,smsg_,arg1_,arg2_) \
     err_ = MPIR_Err_create_code( err_,MPIR_ERR_RECOVERABLE,FCNAME,\
            __LINE__, class_, gmsg_, smsg_, arg1_, arg2_ )
-#define MPIU_ERR_SETANDSTMT(err_,class_,stmt_,msg_) \
+#define MPIR_ERR_SETANDSTMT(err_,class_,stmt_,msg_) \
     do {err_ = MPIR_Err_create_code( err_,MPIR_ERR_RECOVERABLE,FCNAME,\
            __LINE__, class_, msg_, 0 ); stmt_ ;} while (0)
-#define MPIU_ERR_SETANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_) \
+#define MPIR_ERR_SETANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_) \
     do {err_ = MPIR_Err_create_code( err_,MPIR_ERR_RECOVERABLE,FCNAME,\
            __LINE__, class_, gmsg_, smsg_, arg1_ ); stmt_ ;} while (0)
-#define MPIU_ERR_SETANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
+#define MPIR_ERR_SETANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
     do {err_ = MPIR_Err_create_code( err_,MPIR_ERR_RECOVERABLE,FCNAME,\
            __LINE__, class_, gmsg_, smsg_, arg1_, arg2_ ); stmt_ ;} while (0)
-#define MPIU_ERR_SETANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_, arg3_) \
+#define MPIR_ERR_SETANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_, arg3_) \
     do {err_ = MPIR_Err_create_code( err_,MPIR_ERR_RECOVERABLE,FCNAME,\
            __LINE__, class_, gmsg_, smsg_, arg1_, arg2_, arg3_ ); stmt_ ;} while (0)
-#define MPIU_ERR_SETANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_, arg3_, arg4_) \
+#define MPIR_ERR_SETANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_, arg3_, arg4_) \
     do {err_ = MPIR_Err_create_code( err_,MPIR_ERR_RECOVERABLE,FCNAME,\
 	    __LINE__, class_, gmsg_, smsg_, arg1_, arg2_, arg3_, arg4_ ); stmt_ ;} while (0)
 
-#define MPIU_ERR_SETFATALSIMPLE(err_,class_,msg_) \
+#define MPIR_ERR_SETFATALSIMPLE(err_,class_,msg_) \
     err_ = MPIR_Err_create_code( MPI_SUCCESS,MPIR_ERR_FATAL,FCNAME,     \
            __LINE__, class_, msg_, 0 )
-#define MPIU_ERR_SETFATAL(err_,class_,msg_) \
+#define MPIR_ERR_SETFATAL(err_,class_,msg_) \
     err_ = MPIR_Err_create_code( err_,MPIR_ERR_FATAL,FCNAME,\
            __LINE__, class_, msg_, 0 )
-#define MPIU_ERR_SETFATAL1(err_,class_,gmsg_,smsg_,arg1_) \
+#define MPIR_ERR_SETFATAL1(err_,class_,gmsg_,smsg_,arg1_) \
     err_ = MPIR_Err_create_code( err_,MPIR_ERR_FATAL,FCNAME,\
            __LINE__, class_, gmsg_, smsg_, arg1_ )
-#define MPIU_ERR_SETFATAL2(err_,class_,gmsg_,smsg_,arg1_,arg2_) \
+#define MPIR_ERR_SETFATAL2(err_,class_,gmsg_,smsg_,arg1_,arg2_) \
     err_ = MPIR_Err_create_code( err_,MPIR_ERR_FATAL,FCNAME,\
            __LINE__, class_, gmsg_, smsg_, arg1_, arg2_ )
-#define MPIU_ERR_SETFATALANDSTMT(err_,class_,stmt_,msg_) \
+#define MPIR_ERR_SETFATALANDSTMT(err_,class_,stmt_,msg_) \
     do {err_ = MPIR_Err_create_code( err_,MPIR_ERR_FATAL,FCNAME,\
            __LINE__, class_, msg_, 0 ); stmt_ ;} while (0)
-#define MPIU_ERR_SETFATALANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_) \
+#define MPIR_ERR_SETFATALANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_) \
     do {err_ = MPIR_Err_create_code( err_,MPIR_ERR_FATAL,FCNAME,\
            __LINE__, class_, gmsg_, smsg_, arg1_ ); stmt_ ;} while (0)
-#define MPIU_ERR_SETFATALANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
+#define MPIR_ERR_SETFATALANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
     do {err_ = MPIR_Err_create_code( err_,MPIR_ERR_FATAL,FCNAME,\
            __LINE__, class_, gmsg_, smsg_, arg1_, arg2_ ); stmt_ ;} while (0)
-#define MPIU_ERR_SETFATALANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_, arg3_) \
+#define MPIR_ERR_SETFATALANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_, arg3_) \
     do {err_ = MPIR_Err_create_code( err_,MPIR_ERR_FATAL,FCNAME,\
            __LINE__, class_, gmsg_, smsg_, arg1_, arg2_, arg3_ ); stmt_ ;} while (0)
-#define MPIU_ERR_SETFATALANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_, arg3_, arg4_) \
+#define MPIR_ERR_SETFATALANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_, arg3_, arg4_) \
     do {err_ = MPIR_Err_create_code( err_,MPIR_ERR_FATAL,FCNAME,\
 	    __LINE__, class_, gmsg_, smsg_, arg1_, arg2_, arg3_, arg4_ ); stmt_ ;} while (0)
-#define MPIU_ERR_ADD(err_, newerr_) \
+#define MPIR_ERR_ADD(err_, newerr_) \
     do {(err_) = MPIR_Err_combine_codes((err_), (newerr_));} while (0)
 #else
 /* Simply set the class, being careful not to override a previously
    set class. */
-#define MPIU_ERR_SETSIMPLE(err_,class_,msg_)	\
+#define MPIR_ERR_SETSIMPLE(err_,class_,msg_)	\
     do {err_ = class_;} while (0)
-#define MPIU_ERR_SET(err_,class_,msg_) \
+#define MPIR_ERR_SET(err_,class_,msg_) \
     do {if (!err_){err_=class_;}} while (0)
-#define MPIU_ERR_SET1(err_,class_,gmsg_,smsg_,arg1_) \
-      MPIU_ERR_SET(err_,class_,msg_)
-#define MPIU_ERR_SET2(err_,class_,gmsg_,smsg_,arg1_,arg2_) \
-      MPIU_ERR_SET(err_,class_,msg_)
-#define MPIU_ERR_SETANDSTMT(err_,class_,stmt_,msg_) \
+#define MPIR_ERR_SET1(err_,class_,gmsg_,smsg_,arg1_) \
+      MPIR_ERR_SET(err_,class_,msg_)
+#define MPIR_ERR_SET2(err_,class_,gmsg_,smsg_,arg1_,arg2_) \
+      MPIR_ERR_SET(err_,class_,msg_)
+#define MPIR_ERR_SETANDSTMT(err_,class_,stmt_,msg_) \
     do {if (!err_){err_=class_;} stmt_;} while (0)
-#define MPIU_ERR_SETANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_) \
-     MPIU_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
-#define MPIU_ERR_SETANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
-     MPIU_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
-#define MPIU_ERR_SETANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
-     MPIU_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
-#define MPIU_ERR_SETANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
-     MPIU_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
-
-#define MPIU_ERR_SETFATALSIMPLE(err_,class_,msg_)	\
+#define MPIR_ERR_SETANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_) \
+     MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
+#define MPIR_ERR_SETANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
+     MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
+#define MPIR_ERR_SETANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
+     MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
+#define MPIR_ERR_SETANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
+     MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
+
+#define MPIR_ERR_SETFATALSIMPLE(err_,class_,msg_)	\
     do {err_ = class_;} while (0)
-#define MPIU_ERR_SETFATAL(err_,class_,msg_) \
+#define MPIR_ERR_SETFATAL(err_,class_,msg_) \
     do {if (!err_){err_=class_;}} while (0)
-#define MPIU_ERR_SETFATAL1(err_,class_,gmsg_,smsg_,arg1_) \
-      MPIU_ERR_SET(err_,class_,msg_)
-#define MPIU_ERR_SETFATAL2(err_,class_,gmsg_,smsg_,arg1_,arg2_) \
-      MPIU_ERR_SET(err_,class_,msg_)
-#define MPIU_ERR_SETFATALANDSTMT(err_,class_,stmt_,msg_) \
-     MPIU_ERR_SETANDSTMT(err_,class_,stmt_,msg_)
-#define MPIU_ERR_SETFATALANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_) \
-     MPIU_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
-#define MPIU_ERR_SETFATALANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
-     MPIU_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
-#define MPIU_ERR_SETFATALANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
-     MPIU_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
-#define MPIU_ERR_SETFATALANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
-     MPIU_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
+#define MPIR_ERR_SETFATAL1(err_,class_,gmsg_,smsg_,arg1_) \
+      MPIR_ERR_SET(err_,class_,msg_)
+#define MPIR_ERR_SETFATAL2(err_,class_,gmsg_,smsg_,arg1_,arg2_) \
+      MPIR_ERR_SET(err_,class_,msg_)
+#define MPIR_ERR_SETFATALANDSTMT(err_,class_,stmt_,msg_) \
+     MPIR_ERR_SETANDSTMT(err_,class_,stmt_,msg_)
+#define MPIR_ERR_SETFATALANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_) \
+     MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
+#define MPIR_ERR_SETFATALANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
+     MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
+#define MPIR_ERR_SETFATALANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
+     MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
+#define MPIR_ERR_SETFATALANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
+     MPIR_ERR_SETANDSTMT(err_,class_,stmt_,gmsg_)
     /* No-op - use original error class; discard newerr_ unless err is 
        MPI_SUCCESS*/
-#define MPIU_ERR_ADD(err_, newerr_) \
+#define MPIR_ERR_ADD(err_, newerr_) \
     do {if (!err_) err_ = newerr_;} while (0)
 #endif
 
 /* The following definitions are the same independent of the choice of 
    HAVE_ERROR_CHECKING */
-#define MPIU_ERR_SETANDJUMP(err_,class_,msg_) \
-     MPIU_ERR_SETANDSTMT(err_,class_,goto fn_fail,msg_)
-#define MPIU_ERR_SETFATALANDJUMP(err_,class_,msg_) \
-     MPIU_ERR_SETFATALANDSTMT(err_,class_,goto fn_fail,msg_)
-#define MPIU_ERR_CHKANDSTMT(cond_,err_,class_,stmt_,msg_) \
-    do {if (cond_) { MPIU_ERR_SETANDSTMT(err_,class_,stmt_,msg_); }} while (0)
-#define MPIU_ERR_CHKFATALANDSTMT(cond_,err_,class_,stmt_,msg_) \
-    do {if (cond_) { MPIU_ERR_SETFATALANDSTMT(err_,class_,stmt_,msg_); }} while (0)
-#define MPIU_ERR_CHKANDJUMP(cond_,err_,class_,msg_) \
-     MPIU_ERR_CHKANDSTMT(cond_,err_,class_,goto fn_fail,msg_)
-#define MPIU_ERR_CHKFATALANDJUMP(cond_,err_,class_,msg_) \
-     MPIU_ERR_CHKFATALANDSTMT(cond_,err_,class_,goto fn_fail,msg_)
-
-#define MPIU_ERR_SETANDJUMP1(err_,class_,gmsg_,smsg_,arg1_) \
-     MPIU_ERR_SETANDSTMT1(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_)
-#define MPIU_ERR_SETFATALANDJUMP1(err_,class_,gmsg_,smsg_,arg1_) \
-     MPIU_ERR_SETFATALANDSTMT1(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_)
-#define MPIU_ERR_CHKANDSTMT1(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_) \
-    do {if (cond_) { MPIU_ERR_SETANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_); }} while (0)
-#define MPIU_ERR_CHKFATALANDSTMT1(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_) \
-    do {if (cond_) { MPIU_ERR_SETFATALANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_); }} while (0)
-#define MPIU_ERR_CHKANDJUMP1(cond_,err_,class_,gmsg_,smsg_,arg1_) \
-     MPIU_ERR_CHKANDSTMT1(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_)
-#define MPIU_ERR_CHKFATALANDJUMP1(cond_,err_,class_,gmsg_,smsg_,arg1_) \
-     MPIU_ERR_CHKFATALANDSTMT1(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_)
-
-#define MPIU_ERR_SETANDJUMP2(err_,class_,gmsg_,smsg_,arg1_,arg2_) \
-     MPIU_ERR_SETANDSTMT2(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_)
-#define MPIU_ERR_SETFATALANDJUMP2(err_,class_,gmsg_,smsg_,arg1_,arg2_) \
-     MPIU_ERR_SETFATALANDSTMT2(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_)
-#define MPIU_ERR_CHKANDSTMT2(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
-    do {if (cond_) { MPIU_ERR_SETANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_); }} while (0)
-#define MPIU_ERR_CHKFATALANDSTMT2(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
-    do {if (cond_) { MPIU_ERR_SETFATALANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_); }} while (0)
-#define MPIU_ERR_CHKANDJUMP2(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_) \
-     MPIU_ERR_CHKANDSTMT2(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_)
-#define MPIU_ERR_CHKFATALANDJUMP2(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_) \
-     MPIU_ERR_CHKFATALANDSTMT2(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_)
-
-#define MPIU_ERR_SETANDJUMP3(err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
-     MPIU_ERR_SETANDSTMT3(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_)
-#define MPIU_ERR_SETFATALANDJUMP3(err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
-     MPIU_ERR_SETFATALANDSTMT3(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_)
-#define MPIU_ERR_CHKANDSTMT3(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
-    do {if (cond_) { MPIU_ERR_SETANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_); }} while (0)
-#define MPIU_ERR_CHKFATALANDSTMT3(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
-    do {if (cond_) { MPIU_ERR_SETFATALANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_); }} while (0)
-#define MPIU_ERR_CHKANDJUMP3(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
-     MPIU_ERR_CHKANDSTMT3(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_)
-#define MPIU_ERR_CHKFATALANDJUMP3(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
-     MPIU_ERR_CHKFATALANDSTMT3(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_)
-
-#define MPIU_ERR_SETANDJUMP4(err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
-     MPIU_ERR_SETANDSTMT4(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_)
-#define MPIU_ERR_SETFATALANDJUMP4(err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
-     MPIU_ERR_SETFATALANDSTMT4(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_)
-#define MPIU_ERR_CHKANDSTMT4(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_, arg4_) \
-    do {if (cond_) { MPIU_ERR_SETANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_); }} while (0)
-#define MPIU_ERR_CHKFATALANDSTMT4(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_, arg4_) \
-    do {if (cond_) { MPIU_ERR_SETFATALANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_); }} while (0)
-#define MPIU_ERR_CHKANDJUMP4(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
-     MPIU_ERR_CHKANDSTMT4(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_)
-#define MPIU_ERR_CHKFATALANDJUMP4(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
-     MPIU_ERR_CHKFATALANDSTMT4(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_)
-
-#define MPIU_ERR_INTERNAL(err_, msg_)   \
-    MPIU_ERR_SETFATAL1(err_, MPI_ERR_INTERN, "**intern", "**intern %s", msg_)
-#define MPIU_ERR_INTERNALANDSTMT(err_, msg_, stmt_) \
-    MPIU_ERR_SETANDSTMT1(err_, MPI_ERR_INTERN, stmt_, "**intern", "**intern %s", msg_)
-#define MPIU_ERR_INTERNALANDJUMP(err_, msg_) \
-    MPIU_ERR_INTERNALANDSTMT(err_, msg_, goto fn_fail)
-#define MPIU_ERR_CHKINTERNAL(cond_, err_, msg_) \
-    do {if (cond_) MPIU_ERR_INTERNALANDJUMP(err_, msg_);} while(0)
+#define MPIR_ERR_SETANDJUMP(err_,class_,msg_) \
+     MPIR_ERR_SETANDSTMT(err_,class_,goto fn_fail,msg_)
+#define MPIR_ERR_SETFATALANDJUMP(err_,class_,msg_) \
+     MPIR_ERR_SETFATALANDSTMT(err_,class_,goto fn_fail,msg_)
+#define MPIR_ERR_CHKANDSTMT(cond_,err_,class_,stmt_,msg_) \
+    do {if (cond_) { MPIR_ERR_SETANDSTMT(err_,class_,stmt_,msg_); }} while (0)
+#define MPIR_ERR_CHKFATALANDSTMT(cond_,err_,class_,stmt_,msg_) \
+    do {if (cond_) { MPIR_ERR_SETFATALANDSTMT(err_,class_,stmt_,msg_); }} while (0)
+#define MPIR_ERR_CHKANDJUMP(cond_,err_,class_,msg_) \
+     MPIR_ERR_CHKANDSTMT(cond_,err_,class_,goto fn_fail,msg_)
+#define MPIR_ERR_CHKFATALANDJUMP(cond_,err_,class_,msg_) \
+     MPIR_ERR_CHKFATALANDSTMT(cond_,err_,class_,goto fn_fail,msg_)
+
+#define MPIR_ERR_SETANDJUMP1(err_,class_,gmsg_,smsg_,arg1_) \
+     MPIR_ERR_SETANDSTMT1(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_)
+#define MPIR_ERR_SETFATALANDJUMP1(err_,class_,gmsg_,smsg_,arg1_) \
+     MPIR_ERR_SETFATALANDSTMT1(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_)
+#define MPIR_ERR_CHKANDSTMT1(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_) \
+    do {if (cond_) { MPIR_ERR_SETANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_); }} while (0)
+#define MPIR_ERR_CHKFATALANDSTMT1(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_) \
+    do {if (cond_) { MPIR_ERR_SETFATALANDSTMT1(err_,class_,stmt_,gmsg_,smsg_,arg1_); }} while (0)
+#define MPIR_ERR_CHKANDJUMP1(cond_,err_,class_,gmsg_,smsg_,arg1_) \
+     MPIR_ERR_CHKANDSTMT1(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_)
+#define MPIR_ERR_CHKFATALANDJUMP1(cond_,err_,class_,gmsg_,smsg_,arg1_) \
+     MPIR_ERR_CHKFATALANDSTMT1(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_)
+
+#define MPIR_ERR_SETANDJUMP2(err_,class_,gmsg_,smsg_,arg1_,arg2_) \
+     MPIR_ERR_SETANDSTMT2(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_)
+#define MPIR_ERR_SETFATALANDJUMP2(err_,class_,gmsg_,smsg_,arg1_,arg2_) \
+     MPIR_ERR_SETFATALANDSTMT2(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_)
+#define MPIR_ERR_CHKANDSTMT2(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
+    do {if (cond_) { MPIR_ERR_SETANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_); }} while (0)
+#define MPIR_ERR_CHKFATALANDSTMT2(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_) \
+    do {if (cond_) { MPIR_ERR_SETFATALANDSTMT2(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_); }} while (0)
+#define MPIR_ERR_CHKANDJUMP2(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_) \
+     MPIR_ERR_CHKANDSTMT2(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_)
+#define MPIR_ERR_CHKFATALANDJUMP2(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_) \
+     MPIR_ERR_CHKFATALANDSTMT2(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_)
+
+#define MPIR_ERR_SETANDJUMP3(err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
+     MPIR_ERR_SETANDSTMT3(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_)
+#define MPIR_ERR_SETFATALANDJUMP3(err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
+     MPIR_ERR_SETFATALANDSTMT3(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_)
+#define MPIR_ERR_CHKANDSTMT3(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
+    do {if (cond_) { MPIR_ERR_SETANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_); }} while (0)
+#define MPIR_ERR_CHKFATALANDSTMT3(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
+    do {if (cond_) { MPIR_ERR_SETFATALANDSTMT3(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_); }} while (0)
+#define MPIR_ERR_CHKANDJUMP3(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
+     MPIR_ERR_CHKANDSTMT3(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_)
+#define MPIR_ERR_CHKFATALANDJUMP3(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_) \
+     MPIR_ERR_CHKFATALANDSTMT3(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_)
+
+#define MPIR_ERR_SETANDJUMP4(err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
+     MPIR_ERR_SETANDSTMT4(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_)
+#define MPIR_ERR_SETFATALANDJUMP4(err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
+     MPIR_ERR_SETFATALANDSTMT4(err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_)
+#define MPIR_ERR_CHKANDSTMT4(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_, arg4_) \
+    do {if (cond_) { MPIR_ERR_SETANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_); }} while (0)
+#define MPIR_ERR_CHKFATALANDSTMT4(cond_,err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_, arg4_) \
+    do {if (cond_) { MPIR_ERR_SETFATALANDSTMT4(err_,class_,stmt_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_); }} while (0)
+#define MPIR_ERR_CHKANDJUMP4(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
+     MPIR_ERR_CHKANDSTMT4(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_)
+#define MPIR_ERR_CHKFATALANDJUMP4(cond_,err_,class_,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_) \
+     MPIR_ERR_CHKFATALANDSTMT4(cond_,err_,class_,goto fn_fail,gmsg_,smsg_,arg1_,arg2_,arg3_,arg4_)
+
+#define MPIR_ERR_INTERNAL(err_, msg_)   \
+    MPIR_ERR_SETFATAL1(err_, MPI_ERR_INTERN, "**intern", "**intern %s", msg_)
+#define MPIR_ERR_INTERNALANDSTMT(err_, msg_, stmt_) \
+    MPIR_ERR_SETANDSTMT1(err_, MPI_ERR_INTERN, stmt_, "**intern", "**intern %s", msg_)
+#define MPIR_ERR_INTERNALANDJUMP(err_, msg_) \
+    MPIR_ERR_INTERNALANDSTMT(err_, msg_, goto fn_fail)
+#define MPIR_ERR_CHKINTERNAL(cond_, err_, msg_) \
+    do {if (cond_) MPIR_ERR_INTERNALANDJUMP(err_, msg_);} while(0)
 
 /* --END ERROR MACROS-- */
 
diff --git a/src/include/mpihandlemem.h b/src/include/mpihandlemem.h
index 1847031..e099cb8 100644
--- a/src/include/mpihandlemem.h
+++ b/src/include/mpihandlemem.h
@@ -244,40 +244,6 @@ typedef int MPIU_Handle_ref_count;
         MPIU_HANDLE_CHECK_REFCOUNT(objptr_,"decr");       \
     } while (0)
 
-#elif MPIU_THREAD_REFCOUNT == MPIU_REFCOUNT_LOCK
-
-typedef volatile int MPIU_Handle_ref_count;
-#define MPIU_HANDLE_REF_COUNT_INITIALIZER(val_) (val_)
-
-#define MPIU_Object_set_ref(objptr_,val)                 \
-    do {                                                 \
-        MPIU_THREAD_CS_ENTER(HANDLE,objptr_);            \
-        (objptr_)->ref_count = val;                      \
-        MPIU_HANDLE_LOG_REFCOUNT_CHANGE(objptr_, "set"); \
-        MPIU_THREAD_CS_EXIT(HANDLE,objptr_);             \
-    } while (0)
-
-/* must be used with care, since there is no synchronization for this read */
-#define MPIU_Object_get_ref(objptr_) \
-    ((objptr_)->ref_count)
-
-#define MPIU_Object_add_ref_always(objptr_)               \
-    do {                                                  \
-        MPIU_THREAD_CS_ENTER(HANDLE,objptr_);             \
-        (objptr_)->ref_count++;                           \
-        MPIU_HANDLE_LOG_REFCOUNT_CHANGE(objptr_, "incr"); \
-        MPIU_HANDLE_CHECK_REFCOUNT(objptr_,"incr");       \
-        MPIU_THREAD_CS_EXIT(HANDLE,objptr_);              \
-    } while (0)
-#define MPIU_Object_release_ref_always(objptr_,inuse_ptr) \
-    do {                                                  \
-        MPIU_THREAD_CS_ENTER(HANDLE,objptr_);             \
-        *(inuse_ptr) = --((objptr_)->ref_count);          \
-        MPIU_HANDLE_LOG_REFCOUNT_CHANGE(objptr_, "decr"); \
-        MPIU_HANDLE_CHECK_REFCOUNT(objptr_,"decr");       \
-        MPIU_THREAD_CS_EXIT(HANDLE,objptr_);              \
-    } while (0)
-
 #elif MPIU_THREAD_REFCOUNT == MPIU_REFCOUNT_LOCKFREE
 
 #include "opa_primitives.h"
@@ -384,7 +350,6 @@ typedef OPA_int_t MPIU_Handle_ref_count;
  * NOTE: This macro *must* be invoked as the very first element of the structure! */
 #define MPIU_OBJECT_HEADER             \
     int handle;                        \
-    MPIU_THREAD_OBJECT_HOOK/*no-semi*/ \
     MPIU_Handle_ref_count ref_count/*semicolon intentionally omitted*/
 
 /* ALL objects have the handle as the first value. */
diff --git a/src/include/mpiimpl.h b/src/include/mpiimpl.h
index 6a3fa60..8423eeb 100644
--- a/src/include/mpiimpl.h
+++ b/src/include/mpiimpl.h
@@ -136,8 +136,6 @@ int usleep(useconds_t usec);
     } while (0)
 #endif
 
-#include "mpiimplthread.h"
-
 /* ------------------------------------------------------------------------- */
 /* mpidebug.h */
 /* ------------------------------------------------------------------------- */
@@ -450,10 +448,10 @@ int MPIU_Handle_free( void *((*)[]), int );
 #define MPID_Comm_valid_ptr(ptr,err,ignore_rev) {     \
      MPID_Valid_ptr_class(Comm,ptr,MPI_ERR_COMM,err); \
      if ((ptr) && MPIU_Object_get_ref(ptr) <= 0) {    \
-         MPIU_ERR_SET(err,MPI_ERR_COMM,"**comm");     \
+         MPIR_ERR_SET(err,MPI_ERR_COMM,"**comm");     \
          ptr = 0;                                     \
      } else if ((ptr) && (ptr)->revoked && !(ignore_rev)) {        \
-         MPIU_ERR_SET(err,MPIX_ERR_REVOKED,"**comm"); \
+         MPIR_ERR_SET(err,MPIX_ERR_REVOKED,"**comm"); \
      }                                                \
 }
 #define MPID_Group_valid_ptr(ptr,err) MPID_Valid_ptr_class(Group,ptr,MPI_ERR_GROUP,err)
@@ -1284,7 +1282,7 @@ int MPIR_Comm_delete_internal(MPID_Comm * comm_ptr);
 #undef FUNCNAME
 #define FUNCNAME MPIR_Comm_release
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 static inline int MPIR_Comm_release(MPID_Comm * comm_ptr)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -1462,7 +1460,6 @@ struct MPID_Grequest_fns {
                                                        the generalize req */
 };
 
-/* see mpiimplthread.h for the def of MPID_cc_t and related functions/macros */
 #define MPID_Request_is_complete(req_) (MPID_cc_is_complete((req_)->cc_ptr))
 
 /*S
@@ -3719,8 +3716,6 @@ int MPID_Comm_get_lpid(MPID_Comm *comm_ptr, int idx, int * lpid_ptr, MPIU_BOOL i
  * collectives */
 #include "mpir_nbc.h"
 
-#include "mpiimplthreadpost.h"
-
 /* Include definitions from the device which require items defined by this 
    file (mpiimpl.h). */
 #include "mpidpost.h"
@@ -4397,7 +4392,7 @@ int MPIR_Comm_set_attr_impl(MPID_Comm *comm_ptr, int comm_keyval, void *attribut
 #undef FUNCNAME
 #define FUNCNAME MPIR_process_status
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 static inline void MPIR_Process_status(MPI_Status *status, MPIR_Errflag_t *errflag)
 {
     if (MPI_PROC_NULL != status->MPI_SOURCE &&
diff --git a/src/include/mpiimplthread.h b/src/include/mpiimplthread.h
deleted file mode 100644
index 4e5a0d7..0000000
--- a/src/include/mpiimplthread.h
+++ /dev/null
@@ -1,1044 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
-/*
- *  (C) 2001 by Argonne National Laboratory.
- *      See COPYRIGHT in top-level directory.
- */
-
-#if !defined(MPIIMPLTHREAD_H_INCLUDED)
-#define MPIIMPLTHREAD_H_INCLUDED
-
-#ifndef HAVE_MPICHCONF
-#error 'This file requires mpichconf.h'
-#endif
-
-#if !defined(MPID_THREAD_DEBUG) && defined(MPICH_DEBUG_MUTEXNESTING)
-#define MPID_THREAD_DEBUG 1
-#endif
-
-/* Make the CPP definition that will be used to control whether threaded
-   code is supported.  Test ONLY on whether MPICH_IS_THREADED is defined.
-
-   Rather than embed a conditional test in the MPICH code, we define a
-   single value on which we can test
- */
-#if !defined(MPICH_THREAD_LEVEL) || !defined(MPI_THREAD_MULTIPLE)
-#error Internal error in macro definitions in include/mpiimplthread.h
-#endif
-#if (MPICH_THREAD_LEVEL == MPI_THREAD_MULTIPLE)
-#define MPICH_IS_THREADED 1
-#endif
-
-/* mpid_thread.h is needed at serialized and above because we might need to
- * store some thread-local data */
-#if (MPICH_THREAD_LEVEL >= MPI_THREAD_SERIALIZED)
-#include "mpid_thread.h"
-#endif
-
-#if MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_INVALID
-#  error Invalid thread granularity option specified (possibly none)
-#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_BRIEF_GLOBAL
-#  error The BRIEF_GLOBAL thread granularity option is no longer supported
-#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_LOCK_FREE
-#  error MPIU_THREAD_GRANULARITY_LOCK_FREE not implemented yet
-#endif
-
-
-/* I don't have a better place for this at the moment, so it lives here for now. */
-enum MPIU_Thread_cs_name {
-    MPIU_THREAD_CS_NAME_ALLFUNC = 0,
-    MPIU_THREAD_CS_NAME_INIT,
-    MPIU_THREAD_CS_NAME_HANDLE,
-    MPIU_THREAD_CS_NAME_HANDLEALLOC,
-    MPIU_THREAD_CS_NAME_MPIDCOMM,
-    MPIU_THREAD_CS_NAME_COMPLETION,
-    MPIU_THREAD_CS_NAME_PMI,
-    MPIU_THREAD_CS_NAME_CONTEXTID,
-    MPIU_THREAD_CS_NAME_MPI_OBJ,
-    MPIU_THREAD_CS_NAME_MSGQUEUE,
-    /* FIXME device-specific, should this live here? */
-    /*
-    MPIU_THREAD_CS_NAME_CH3COMM,
-     */
-    MPIU_THREAD_CS_NUM_NAMES
-};
-
-typedef struct MPICH_ThreadInfo_t {
-    int               thread_provided;  /* Provided level of thread support */
-    /* This is a special case for is_thread_main, which must be
-       implemented even if MPICH itself is single threaded.  */
-#if (MPICH_THREAD_LEVEL >= MPI_THREAD_SERIALIZED)
-#  if !defined(MPIU_TLS_SPECIFIER)
-    MPID_Thread_tls_t thread_storage;   /* Id for perthread data */
-#  endif /* !TLS */
-    MPID_Thread_id_t  master_thread;    /* Thread that started MPI */
-#endif
-
-#if defined MPICH_IS_THREADED
-    int isThreaded;                      /* Set to true if user requested
-					    THREAD_MULTIPLE */
-#endif /* MPICH_IS_THREADED */
-
-    /* Define the mutex values used for each kind of implementation */
-#if MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_GLOBAL || \
-    MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
-    MPID_Thread_mutex_t global_mutex;
-    /* We need the handle mutex to avoid problems with lock nesting */
-    MPID_Thread_mutex_t handle_mutex;
-#endif
-
-#if MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
-    MPID_Thread_mutex_t msgq_mutex;
-    MPID_Thread_mutex_t completion_mutex;
-    MPID_Thread_mutex_t ctx_mutex;
-    MPID_Thread_mutex_t pmi_mutex;
-#endif
-
-#if (MPICH_THREAD_LEVEL >= MPI_THREAD_SERIALIZED)
-    MPID_Thread_mutex_t memalloc_mutex; /* for MPIU_{Malloc,Free,Calloc} */
-    MPID_Thread_id_t cs_holder[MPIU_THREAD_CS_NUM_NAMES];
-#endif
-} MPICH_ThreadInfo_t;
-extern MPICH_ThreadInfo_t MPIR_ThreadInfo;
-
-#ifndef MPICH_IS_THREADED
-
-#define MPIU_THREAD_CHECK_BEGIN
-#define MPIU_THREAD_CHECK_END
-#define MPIU_ISTHREADED (0)
-
-#else /* defined(MPICH_IS_THREADED) */
-
-#define MPIU_THREAD_CHECK_BEGIN if (MPIR_ThreadInfo.isThreaded) {
-#define MPIU_THREAD_CHECK_END   }
-/* This macro used to take an argument of one or more statements that
- * would be wrapped in a conditional.  However it was not used anywhere
- * in part because it looked unnatural.  This version takes no arguments
- * and evaluates to a boolean expression that is true if MPICH is
- * threaded (including any runtime check if needed) and false otherwise.
- * MPIU_THREAD_CHECK_{BEGIN,END} should probably still be used if you
- * don't have any other conditions that you need to check in order to
- * completely eliminate unnecessary if's. */
-#define MPIU_ISTHREADED (MPIR_ThreadInfo.isThreaded)
-
-#endif /* MPICH_IS_THREADED */
-
-/* ------------------------------------------------------------------------- */
-/* thread-local storage macros */
-/* moved here from mpiimpl.h because they logically belong here */
-
-/* Time stamps */
-/* Get the timer definitions.  The source file for this include is
-   src/mpi/timer/mpichtimer.h.in */
-#include "mpichtimer.h"
-
-typedef struct MPID_Stateinfo_t {
-    MPID_Time_t stamp;
-    int count;
-} MPID_Stateinfo_t;
-#define MPICH_MAX_STATES 512
-
-/* arbitrary, just needed to avoid cleaning up heap allocated memory at thread
- * destruction time */
-#define MPIU_STRERROR_BUF_SIZE (1024)
-
-/* FIXME should really be MPIU_Nest_NUM_MUTEXES, but it's defined later */
-#define MPICH_MAX_LOCKS (6)
-
-/* This structure contains all thread-local variables and will be zeroed at
- * allocation time.
- *
- * Note that any pointers to dynamically allocated memory stored in this
- * structure must be externally cleaned up.
- * */
-typedef struct MPICH_PerThread_t {
-    int              op_errno;     /* For errors in predefined MPI_Ops */
-
-    /* error string storage for MPIU_Strerror */
-    char strerrbuf[MPIU_STRERROR_BUF_SIZE];
-
-#if (MPICH_THREAD_LEVEL >= MPI_THREAD_SERIALIZED)
-    int lock_depth[MPICH_MAX_LOCKS];
-#endif
-    /* FIXME: Is this used anywhere? */
-#ifdef HAVE_TIMING
-    MPID_Stateinfo_t timestamps[MPICH_MAX_STATES];  /* per thread state info */
-#endif
-#if defined(MPID_DEV_PERTHREAD_DECL)
-    MPID_DEV_PERTHREAD_DECL
-#endif
-} MPICH_PerThread_t;
-
-#if !defined(MPICH_IS_THREADED)
-/* If single threaded, make this point at a pre-allocated segment.
-   This structure is allocated in src/mpi/init/initthread.c */
-extern MPICH_PerThread_t MPIR_Thread;
-
-/* The following three macros define a way to portably access thread-private
-   storage in MPICH, and avoid extra overhead when MPICH is single
-   threaded
-   INITKEY - Create the key.  Must happen *before* the other threads
-             are created
-   INIT    - Create the thread-private storage.  Must happen once per thread
-   DECL    - Declare local variables
-   GET     - Access the thread-private storage
-   FIELD   - Access the thread-private field (by name)
-   FINALIZE - to be invoked when all threads no longer need access to the thread
-              local storage, such as at MPI_Finalize time
-
-   The "DECL" is the extern so that there is always a statement for
-   the declaration.
-*/
-#define MPIU_THREADPRIV_INITKEY
-#define MPIU_THREADPRIV_INIT
-/* Empty declarations are not allowed in C, so we just define a dummy
- * variable and tell the compiler it is unused. */
-#define MPIU_THREADPRIV_DECL int MPIU_THREADPRIV_LOCAL_DUMMY_VAR ATTRIBUTE((unused))
-#define MPIU_THREADPRIV_GET
-#define MPIU_THREADPRIV_FIELD(a_) (MPIR_Thread.a_)
-
-#else /* defined(MPICH_IS_THREADED) */
-
-/* We need to provide a function that will cleanup the storage attached
-   to the key.  */
-void MPIR_CleanupThreadStorage(void *a);
-
-#if !defined(MPIU_TLS_SPECIFIER)
-/* In the case where the thread level is set in MPI_Init_thread, we
-   need a blended version of the non-threaded and the thread-multiple
-   definitions.
-
-   The approach is to have TWO MPICH_PerThread_t pointers.  One is local
-   (The MPIU_THREADPRIV_DECL is used in the routines local definitions),
-   as in the threaded version of these macros.  This is set by using a routine
-   to get thread-private storage.  The second is a preallocated, extern
-   MPICH_PerThread_t struct, as in the single threaded case.  Based on
-   MPIR_Process.isThreaded, one or the other is used.
-
- */
-/* For the single threaded case, we use a preallocated structure
-   This structure is allocated in src/mpi/init/initthread.c */
-extern MPICH_PerThread_t MPIR_ThreadSingle;
-
-#define MPIU_THREADPRIV_INITKEY                                         \
-    do {                                                                \
-        if (MPIU_ISTHREADED) {                                          \
-            int err_;                                                   \
-            MPID_Thread_tls_create(MPIR_CleanupThreadStorage,&MPIR_ThreadInfo.thread_storage,&err_); \
-            MPIU_Assert(err_ == 0);                                     \
-        }                                                               \
-    } while (0)
-#define MPIU_THREADPRIV_INIT                                                                            \
-    do {                                                                                                \
-        if (MPIU_ISTHREADED) {                                                                          \
-            MPIR_Thread = (MPICH_PerThread_t *) MPIU_Calloc(1, sizeof(MPICH_PerThread_t));              \
-            MPIU_Assert(MPIR_Thread);                                                                   \
-            MPID_Thread_tls_set(&MPIR_ThreadInfo.thread_storage, (void *)MPIR_Thread);                  \
-        }                                                                                               \
-    } while (0)
-/* MPIU_THREADPRIV_INIT must *always* be called before MPIU_THREADPRIV_GET */
-#define MPIU_THREADPRIV_GET                                                         \
-    do {                                                                            \
-        if (!MPIR_Thread) {                                                         \
-            if (MPIU_ISTHREADED) {                                                  \
-                MPID_Thread_tls_get(&MPIR_ThreadInfo.thread_storage, &MPIR_Thread); \
-                if (!MPIR_Thread) {                                                 \
-                    MPIU_THREADPRIV_INIT; /* subtle, sets MPIR_Thread */            \
-                }                                                                   \
-            }                                                                       \
-            else {                                                                  \
-                MPIR_Thread = &MPIR_ThreadSingle;                                   \
-            }                                                                       \
-            MPIU_Assert(MPIR_Thread);                                               \
-        }                                                                           \
-    } while (0)
-
-/* common definitions when using MPID_Thread-based TLS */
-#define MPIU_THREADPRIV_DECL MPICH_PerThread_t *MPIR_Thread=NULL
-#define MPIU_THREADPRIV_FIELD(a_) (MPIR_Thread->a_)
-#define MPIU_THREADPRIV_FINALIZE                                                        \
-    do {                                                                                \
-        MPIU_THREADPRIV_DECL;                                                           \
-        if (MPIU_ISTHREADED) {                                                          \
-            int tpf_err_; /* unique name to not conflict with vars in called macros */  \
-            MPIU_THREADPRIV_GET;                                                        \
-            MPIU_Free(MPIR_Thread);                                                     \
-            MPID_Thread_tls_set(&MPIR_ThreadInfo.thread_storage,NULL);                  \
-            MPID_Thread_tls_destroy(&MPIR_ThreadInfo.thread_storage,&tpf_err_);         \
-            MPIU_Assert(tpf_err_ == 0);                                                 \
-        }                                                                               \
-    } while (0)
-
-#else /* defined(MPIU_TLS_SPECIFIER) */
-
-/* We have proper thread-local storage (TLS) support from the compiler, which
- * should yield the best performance and simplest code, so we'll use that. */
-extern MPIU_TLS_SPECIFIER MPICH_PerThread_t MPIR_Thread;
-
-#define MPIU_THREADPRIV_INITKEY
-#define MPIU_THREADPRIV_INIT
-/* Empty declarations are not allowed in C, so we just define a dummy
- * variable and tell the compiler it is unused. */
-#define MPIU_THREADPRIV_DECL int MPIU_THREADPRIV_LOCAL_DUMMY_VAR ATTRIBUTE((unused))
-#define MPIU_THREADPRIV_GET
-#define MPIU_THREADPRIV_FIELD(a_) (MPIR_Thread.a_)
-#define MPIU_THREADPRIV_FINALIZE do{}while(0)
-
-#endif /* defined(MPIU_TLS_SPECIFIER) */
-#endif /* defined(MPICH_IS_THREADED) */
-
-/* ------------------------------------------------------------------------- */
-/*
- * New definitions for controling the granularity of thread atomicity
- *
- * If MPICH supports threads and the device doesn't wish to override our
- * definitions, we supply default definitions.
- *
- * If the device does choose to override our definitions, it needs to do the
- * following at a minimum:
- * 1) #define MPID_DEVICE_DEFINES_THREAD_CS in mpidpre.h
- * 2) provide #defines for MPIU_THREAD_CS_{INIT,FINALIZE}
- * 3) provide #defines for MPIU_THREAD_CS_{ENTER,EXIT,YIELD}(name_,context_)
- * 4) provide #defines for MPIU_THREADSAFE_INIT_{DECL,STMT,BLOCK_BEGIN,BLOCK_END,CLEAR}
- */
-#if defined(MPICH_IS_THREADED) && !defined(MPID_DEVICE_DEFINES_THREAD_CS)
-
-/* MPIU_THREAD_CS_INIT will be invoked early in the top level
- * MPI_Init/MPI_Init_thread process.  It is responsible for performing any
- * initialization for the MPIU_THREAD_CS_ macros, as well as invoking
- * MPIU_THREADPRIV_INITKEY and MPIU_THREADPRIV_INIT.
- *
- * MPIR_ThreadInfo.isThreaded will be set prior to this macros invocation, based
- * on the "provided" value to MPI_Init_thread
- */
-#define MPIU_THREAD_CS_INIT     MPIR_Thread_CS_Init()     /* in src/mpi/init/initthread.c */
-#define MPIU_THREAD_CS_FINALIZE MPIR_Thread_CS_Finalize() /* in src/mpi/init/initthread.c */
-
-/* some important critical section names:
- *   ALLFUNC - entered/exited at beginning/end of (nearly) every MPI_ function
- *   INIT - entered before MPID_Init and exited near the end of MPI_Init(_thread)
- * See the analysis of the MPI routines for thread usage properties.  Those
- * routines considered "Access Only" do not require ALLFUNC.  That analysis
- * was very general; in MPICH, some routines may have internal shared
- * state that isn't required by the MPI specification.  Perhaps the
- * best example of this is the MPI_ERROR_STRING routine, where the 
- * instance-specific error messages make use of shared state, and hence
- * must be accessed in a thread-safe fashion (e.g., require an ALLFUNC
- * critical section).  With such routines removed, the set of routines
- * that (probably) do not require ALLFUNC include:
- *
- * MPI_CART_COORDS, MPI_CART_GET, MPI_CART_MAP, MPI_CART_RANK, MPI_CART_SHIFT, 
- * MPI_CART_SUB, MPI_CARTDIM_GET, MPI_COMM_GET_NAME, 
- * MPI_COMM_RANK, MPI_COMM_REMOTE_SIZE, 
- * MPI_COMM_SET_NAME, MPI_COMM_SIZE, MPI_COMM_TEST_INTER, MPI_ERROR_CLASS,
- * MPI_FILE_GET_AMODE, MPI_FILE_GET_ATOMICITY, MPI_FILE_GET_BYTE_OFFSET, 
- * MPI_FILE_GET_POSITION, MPI_FILE_GET_POSITION_SHARED, MPI_FILE_GET_SIZE
- * MPI_FILE_GET_TYPE_EXTENT, MPI_FILE_SET_SIZE, 
- * MPI_FINALIZED, MPI_GET_COUNT, MPI_GET_ELEMENTS, MPI_GRAPH_GET, 
- * MPI_GRAPH_MAP, MPI_GRAPH_NEIGHBORS, MPI_GRAPH_NEIGHBORS_COUNT, 
- * MPI_GRAPHDIMS_GET, MPI_GROUP_COMPARE, MPI_GROUP_RANK, 
- * MPI_GROUP_SIZE, MPI_GROUP_TRANSLATE_RANKS, MPI_INITIALIZED, 
- * MPI_PACK, MPI_PACK_EXTERNAL, MPI_PACK_SIZE, MPI_TEST_CANCELLED, 
- * MPI_TOPO_TEST, MPI_TYPE_EXTENT, MPI_TYPE_GET_ENVELOPE, 
- * MPI_TYPE_GET_EXTENT, MPI_TYPE_GET_NAME, MPI_TYPE_GET_TRUE_EXTENT, 
- * MPI_TYPE_LB, MPI_TYPE_SET_NAME, MPI_TYPE_SIZE, MPI_TYPE_UB, MPI_UNPACK, 
- * MPI_UNPACK_EXTERNAL, MPI_WIN_GET_NAME, MPI_WIN_SET_NAME
- *
- * Some of the routines that could be read-only, but internally may
- * require access or updates to shared data include
- * MPI_COMM_COMPARE (creation of group sets)
- * MPI_COMM_SET_ERRHANDLER (reference count on errhandler)
- * MPI_COMM_CALL_ERRHANDLER (actually ok, but risk high, usage low)
- * MPI_FILE_CALL_ERRHANDLER (ditto)
- * MPI_WIN_CALL_ERRHANDLER (ditto)
- * MPI_ERROR_STRING (access to instance-specific string, which could
- *                   be overwritten by another thread)
- * MPI_FILE_SET_VIEW (setting view a big deal)
- * MPI_TYPE_COMMIT (could update description of type internally,
- *                  including creating a new representation.  Should
- *                  be ok, but, like call_errhandler, low usage)
- * 
- * Note that other issues may force a routine to include the ALLFUNC
- * critical section, such as debugging information that requires shared
- * state.  Such situations should be avoided where possible.
- */
-
-/*M MPIU_THREAD_CS_ENTER - Enter a named critical section
-
-  Input Parameters:
-+ _name - name of the critical section
-- _context - A context (typically an object) of the critical section
-
-M*/
-#define MPIU_THREAD_CS_ENTER(_name,_context) MPIU_THREAD_CS_ENTER_##_name(_context)
-
-/*M MPIU_THREAD_CS_EXIT - Exit a named critical section
-
-  Input Parameters:
-+ _name - cname of the critical section
-- _context - A context (typically an object) of the critical section
-
-M*/
-#define MPIU_THREAD_CS_EXIT(_name,_context) MPIU_THREAD_CS_EXIT_##_name(_context)
-
-/*M MPIU_THREAD_CS_YIELD - Temporarily release a critical section and yield
-    to other threads
-
-  Input Parameters:
-+ _name - cname of the critical section
-- _context - A context (typically an object) of the critical section
-
-  M*/
-#define MPIU_THREAD_CS_YIELD(_name,_context) MPIU_THREAD_CS_YIELD_##_name(_context)
-
-/*M MPIU_THREAD_CS_TRY - Trylock version of ENTER to a named critical section
-
-  Input Parameters:
-+ _name - name of the critical section
-- _context - A context (typically an object) of the critical section
-
-M*/
-#define MPIU_THREAD_CS_TRY(_name,_locked,_context) MPIU_THREAD_CS_TRY_##_name(_context,_locked)
-
-
-/*M
-  ... move the threadsafe init block
-
-  These use a private critical section called INITFLAG
-  M*/
-
-/* FIXME this is a broken version of the Double-Checked Locking Pattern (DCLP).
- * In practice it may work OK, but it certainly isn't guaranteed depending on
- * what the processor, compiler, and pthread implementation choose to do.
- *
- * These might be fixable in practice via OPA memory barriers. */
-#define MPIU_THREADSAFE_INIT_DECL(_var) static volatile int _var=1
-#define MPIU_THREADSAFE_INIT_STMT(_var,_stmt)   \
-    do {                                        \
-        if (_var) {                             \
-            MPIU_THREAD_CS_ENTER(INITFLAG,);    \
-            _stmt;                              \
-            _var=0;                             \
-            MPIU_THREAD_CS_EXIT(INITFLAG,);     \
-        }                                       \
-    while (0)
-#define MPIU_THREADSAFE_INIT_BLOCK_BEGIN(_var)  \
-    MPIU_THREAD_CS_ENTER(INITFLAG,);            \
-    if (_var) {
-#define MPIU_THREADSAFE_INIT_CLEAR(_var) _var=0
-#define MPIU_THREADSAFE_INIT_BLOCK_END(_var)    \
-    }                                           \
-    MPIU_THREAD_CS_EXIT(INITFLAG,)
-
-#elif !defined(MPID_DEVICE_DEFINES_THREAD_CS) /* && !defined(MPICH_IS_THREADED) */
-
-/* These provide a uniform way to perform a first-use initialization
-   in a thread-safe way.  See the web page or mpidtime.c for the generic
-   wtick */
-#define MPIU_THREADSAFE_INIT_DECL(_var) static int _var=1
-#define MPIU_THREADSAFE_INIT_STMT(_var,_stmt) \
-    do {                                      \
-        if (_var) {                           \
-            _stmt;                            \
-            _var = 0;                         \
-        }                                     \
-    } while (0)
-#define MPIU_THREADSAFE_INIT_BLOCK_BEGIN(_var)
-#define MPIU_THREADSAFE_INIT_CLEAR(_var) _var=0
-#define MPIU_THREADSAFE_INIT_BLOCK_END(_var)
-
-#endif
-
-/* Helper definitions for the default macro definitions */
-#if defined(MPICH_IS_THREADED) && !defined(MPID_DEVICE_DEFINES_THREAD_CS)
-#if MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_GLOBAL
-
-#define MPIU_THREAD_CHECKDEPTH(kind_, lockname_, value_)
-#define MPIU_THREAD_UPDATEDEPTH(kind_, lockname_, value_)
-
-#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
-
-/* this nesting is different than the MPIR_Nest_* macros, this is critical
- * section nesting, the other is MPI/NMPI nesting */
-
-/* This structure is used to keep track of where the last change was made
-   to the thread cs depth */
-/* temporarily disabled until we figure out if these should be restored (they
- * are currently broken) */
-#if 0 && MPID_THREAD_DEBUG
-
-#define MPIU_THREAD_CHECKDEPTH(kind_, lockname_, value_)                                   \
-    do {                                                                                   \
-        MPIU_ThreadDebug_t *nest_ptr_ = NULL;                                              \
-        MPIU_THREADPRIV_GET;                                                               \
-        nest_ptr_ = MPIU_THREADPRIV_FIELD(nest_debug);                                     \
-        if (nest_ptr_[kind_].count != value_) {                                            \
-            fprintf(stderr, "%s:%d %s = %d, required %d; previously set in %s:%d(%s)\n",   \
-                    __FILE__, __LINE__,  lockname_,                                        \
-                    nest_ptr_[kind_].count, value_,                                        \
-                    nest_ptr_[kind_].file,                                                 \
-                    nest_ptr_[kind_].line,                                                 \
-                    nest_ptr_[kind_].fname );                                              \
-            fflush(stderr);                                                                \
-        }                                                                                  \
-    } while (0)
-#define MPIU_THREAD_UPDATEDEPTH(kind_, lockname_, value_)                                  \
-    do {                                                                                   \
-        MPIU_ThreadDebug_t *nest_ptr_ = NULL;                                              \
-        MPIU_THREADPRIV_GET;                                                               \
-        nest_ptr_ = MPIU_THREADPRIV_FIELD(nest_debug);                                     \
-        if (nest_ptr_[kind_].count + (value_) < 0) {                                       \
-            fprintf(stderr, "%s:%d %s = %d (<0); previously set in %s:%d(%s)\n",           \
-                    __FILE__, __LINE__,  lockname_,                                        \
-                    nest_ptr_[kind_].count,                                                \
-                    nest_ptr_[kind_].file,                                                 \
-                    nest_ptr_[kind_].line,                                                 \
-                    nest_ptr_[kind_].fname );                                              \
-            fflush(stderr);                                                                \
-        }                                                                                  \
-        nest_ptr_[kind_].count += value_;                                                  \
-        nest_ptr_[kind_].line = __LINE__;                                                  \
-        MPIU_Strncpy( nest_ptr_[kind_].file, __FILE__, MPIU_THREAD_LOC_LEN );              \
-        MPIU_Strncpy( nest_ptr_[kind_].fname, FCNAME, MPIU_THREAD_FNAME_LEN );             \
-    } while (0)
-#else
-#define MPIU_THREAD_CHECKDEPTH(kind_, lockname_, value_)
-#define MPIU_THREAD_UPDATEDEPTH(kind_, lockname_, value_)
-#endif /* MPID_THREAD_DEBUG */
-#endif /* test on THREAD_GRANULARITY */
-
-#define MPIU_THREAD_CS_ENTER_LOCKNAME_RECURSIVE(name_)                                          \
-    do {                                                                                        \
-        MPIU_DBG_MSG_S(THREAD,VERBOSE,"attempting to recursively ENTER lockname=%s", #name_);   \
-        MPIU_Thread_CS_enter_lockname_recursive_impl_(MPIU_Nest_##name_, #name_, &MPIR_ThreadInfo.name_); \
-    } while (0)
-#define MPIU_THREAD_CS_EXIT_LOCKNAME_RECURSIVE(name_)                                           \
-    do {                                                                                        \
-        MPIU_DBG_MSG_S(THREAD,VERBOSE,"attempting to recursively EXIT lockname=%s", #name_);    \
-        MPIU_Thread_CS_exit_lockname_recursive_impl_(MPIU_Nest_##name_, #name_, &MPIR_ThreadInfo.name_);  \
-    } while (0)
-#define MPIU_THREAD_CS_YIELD_LOCKNAME_RECURSIVE(name_)                                          \
-    do {                                                                                        \
-        MPIU_DBG_MSG_S(THREAD,VERBOSE,"attempting to recursively YIELD lockname=%s", #name_);   \
-        MPIU_Thread_CS_yield_lockname_recursive_impl_(MPIU_Nest_##name_, #name_, &MPIR_ThreadInfo.name_); \
-    } while (0)
-#define MPIU_THREAD_CS_TRY_LOCKNAME_RECURSIVE(name_,locked_)                                   \
-    do {                                                                                      \
-        MPIU_Thread_CS_try_lockname_recursive_impl_(MPIU_Nest_##name_, #name_, &MPIR_ThreadInfo.name_, locked_); \
-    } while (0)
-
-
-#define MPIU_THREAD_CS_ENTER_LOCKNAME(name_)                                                   \
-    do {                                                                                       \
-        MPIU_DBG_MSG_S(THREAD,VERBOSE,"attempting to ENTER lockname=%s", #name_);              \
-        MPIU_Thread_CS_enter_lockname_impl_(MPIU_Nest_##name_, #name_, &MPIR_ThreadInfo.name_); \
-    } while (0)
-#define MPIU_THREAD_CS_EXIT_LOCKNAME(name_)                                                    \
-    do {                                                                                       \
-        MPIU_DBG_MSG_S(THREAD,VERBOSE,"attempting to EXIT lockname=%s", #name_);               \
-        MPIU_Thread_CS_exit_lockname_impl_(MPIU_Nest_##name_, #name_, &MPIR_ThreadInfo.name_);  \
-    } while (0)
-#define MPIU_THREAD_CS_YIELD_LOCKNAME(name_)                                                   \
-    do {                                                                                       \
-        MPIU_DBG_MSG_S(THREAD,VERBOSE,"attempting to YIELD lockname=%s", #name_);              \
-        MPIU_Thread_CS_yield_lockname_impl_(MPIU_Nest_##name_, #name_, &MPIR_ThreadInfo.name_); \
-    } while (0)
-
-enum MPIU_Nest_mutexes {
-    MPIU_Nest_global_mutex = 0,
-    MPIU_Nest_handle_mutex,
-    MPIU_Nest_msgq_mutex,
-    MPIU_Nest_completion_mutex,
-    MPIU_Nest_ctx_mutex,
-    MPIU_Nest_pmi_mutex,
-    MPIU_Nest_NUM_MUTEXES
-};
-
-/* Some locks (such as the memory allocation locks) are needed to
- * bootstrap the lock checking code.  These macros provide a similar
- * interface to the MPIU_THREAD_CS_{ENTER,EXIT}_LOCKNAME macros but
- * without the bootstrapping issue. */
-#define MPIU_THREAD_CS_ENTER_LOCKNAME_NOCHECK(_name)                  \
-    do {                                                              \
-        MPIU_DBG_MSG(THREAD,TYPICAL,"Enter critical section "#_name " (checking disabled)"); \
-        MPID_Thread_mutex_lock(&MPIR_ThreadInfo._name);               \
-    } while (0)
-#define MPIU_THREAD_CS_EXIT_LOCKNAME_NOCHECK(_name)                  \
-    do {                                                             \
-        MPIU_DBG_MSG(THREAD,TYPICAL,"Exit critical section "#_name " (checking disabled)"); \
-        MPID_Thread_mutex_unlock(&MPIR_ThreadInfo._name);            \
-    } while (0)
-
-#if defined(USE_MEMORY_TRACING)
-    /* These are defined for all levels of thread granularity due to the
-     * bootstrapping issue mentioned above */
-#   define MPIU_THREAD_CS_ENTER_MEMALLOC(_context)                  \
-        do {                                                        \
-            MPIU_THREAD_CHECK_BEGIN                                 \
-            MPIU_THREAD_CS_ENTER_LOCKNAME_NOCHECK(memalloc_mutex);  \
-            MPIU_THREAD_CHECK_END                                   \
-        } while(0)
-#   define MPIU_THREAD_CS_EXIT_MEMALLOC(_context)                   \
-        do {                                                        \
-            MPIU_THREAD_CHECK_BEGIN                                 \
-            MPIU_THREAD_CS_EXIT_LOCKNAME_NOCHECK(memalloc_mutex);   \
-            MPIU_THREAD_CHECK_END                                   \
-        } while(0)
-#else
-    /* we don't need these macros when using the system malloc */
-#   define MPIU_THREAD_CS_ENTER_MEMALLOC(_context) do {} while (0)
-#   define MPIU_THREAD_CS_EXIT_MEMALLOC(_context) do {} while (0)
-#endif
-
-/* helper macros to insert thread checks around LOCKNAME actions */
-#define MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(name_)    \
-    MPIU_THREAD_CHECK_BEGIN                             \
-    MPIU_THREAD_CS_ENTER_LOCKNAME(name_);               \
-    MPIU_THREAD_CHECK_END
-#define MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(name_)     \
-    MPIU_THREAD_CHECK_BEGIN                             \
-    MPIU_THREAD_CS_EXIT_LOCKNAME(name_);                \
-    MPIU_THREAD_CHECK_END
-#define MPIU_THREAD_CS_YIELD_LOCKNAME_CHECKED(name_)    \
-    MPIU_THREAD_CHECK_BEGIN                             \
-    MPIU_THREAD_CS_YIELD_LOCKNAME(name_);               \
-    MPIU_THREAD_CHECK_END
-
-
-/* Definitions of the thread support for various levels of thread granularity */
-#if MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_GLOBAL
-/* There is a single, global lock, held for the duration of an MPI call */
-/* FIXME this shouldn't need to be recursive, but using a recursive mutex here
- * greatly simplifies thread safety in ROMIO right now.  In the long term we
- * should make ROMIO internally thread safe and then this can go back to being a
- * non-recursive mutex. [goodell@ 2010-10-15] */
-#define MPIU_THREAD_CS_ENTER_ALLFUNC(_context)                 \
-    do {                                                       \
-        MPIU_THREAD_CHECK_BEGIN                                \
-        MPIU_THREAD_CS_ENTER_LOCKNAME_RECURSIVE(global_mutex); \
-        MPIU_THREAD_CHECK_END                                  \
-    } while (0)
-#define MPIU_THREAD_CS_EXIT_ALLFUNC(_context)                 \
-    do {                                                      \
-        MPIU_THREAD_CHECK_BEGIN                               \
-        MPIU_THREAD_CS_EXIT_LOCKNAME_RECURSIVE(global_mutex); \
-        MPIU_THREAD_CHECK_END                                 \
-    } while (0)
-#define MPIU_THREAD_CS_YIELD_ALLFUNC(_context)                 \
-    do {                                                       \
-        MPIU_THREAD_CHECK_BEGIN                                \
-        MPIU_THREAD_CS_YIELD_LOCKNAME_RECURSIVE(global_mutex); \
-        MPIU_THREAD_CHECK_END                                  \
-    } while (0)
-#define MPIU_THREAD_CS_TRY_ALLFUNC(_context,_locked)           \
-    do {                                                       \
-        MPIU_THREAD_CHECK_BEGIN                                \
-        MPIU_THREAD_CS_TRY_LOCKNAME_RECURSIVE(global_mutex,_locked);   \
-        MPIU_THREAD_CHECK_END                                  \
-    } while (0)
-
-/* not _CHECKED, invoked before MPIU_ISTHREADED will work */
-#define MPIU_THREAD_CS_ENTER_INIT(_context)    MPIU_THREAD_CS_ENTER_LOCKNAME_RECURSIVE(global_mutex)
-#define MPIU_THREAD_CS_EXIT_INIT(_context)     MPIU_THREAD_CS_EXIT_LOCKNAME_RECURSIVE(global_mutex)
-
-#define MPIU_THREAD_CS_ENTER_HANDLE(_context)
-#define MPIU_THREAD_CS_EXIT_HANDLE(_context)
-#define MPIU_THREAD_CS_ENTER_HANDLEALLOC(_context)
-#define MPIU_THREAD_CS_EXIT_HANDLEALLOC(_context)
-#define MPIU_THREAD_CS_ENTER_MSGQUEUE(_context)
-#define MPIU_THREAD_CS_EXIT_MSGQUEUE(_context)
-
-#define MPIU_THREAD_CS_ENTER_MPIDCOMM(_context)
-#define MPIU_THREAD_CS_EXIT_MPIDCOMM(_context)
-#define MPIU_THREAD_CS_YIELD_MPIDCOMM(_context)
-
-#define MPIU_THREAD_CS_ENTER_COMPLETION(_context)
-#define MPIU_THREAD_CS_EXIT_COMPLETION(_context)
-#define MPIU_THREAD_CS_YIELD_COMPLETION(_context)
-
-#define MPIU_THREAD_CS_ENTER_INITFLAG(_context)
-#define MPIU_THREAD_CS_EXIT_INITFLAG(_context)
-#define MPIU_THREAD_CS_ENTER_PMI(_context)
-#define MPIU_THREAD_CS_EXIT_PMI(_context)
-
-#define MPIU_THREAD_CS_ENTER_CONTEXTID(_context)
-#define MPIU_THREAD_CS_EXIT_CONTEXTID(_context)
-/* XXX DJG at the global level should CONTEXTID yield even though it
- * doesn't do anything at ENTER/EXIT? */
-#define MPIU_THREAD_CS_YIELD_CONTEXTID(_context)               \
-    do {                                                       \
-        MPIU_THREAD_CHECK_BEGIN                                \
-        MPIU_THREAD_CS_YIELD_LOCKNAME_RECURSIVE(global_mutex); \
-        MPIU_THREAD_CHECK_END                                  \
-    } while (0)
-
-#define MPIU_THREAD_CS_ENTER_MPI_OBJ(context_) do {} while(0)
-#define MPIU_THREAD_CS_EXIT_MPI_OBJ(context_)  do {} while(0)
-
-
-#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
-/* There are multiple locks, one for each (major) object */
-
-#define MPIU_THREAD_CS_ENTER_ALLFUNC(_context)
-#define MPIU_THREAD_CS_EXIT_ALLFUNC(_context)
-#define MPIU_THREAD_CS_YIELD_ALLFUNC(_context)
-
-#define MPIU_THREAD_CS_ENTER_INIT(_context)
-#define MPIU_THREAD_CS_EXIT_INIT(_context)
-
-#define MPIU_THREAD_CS_ENTER_HANDLE(_context) MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(handle_mutex)
-#define MPIU_THREAD_CS_EXIT_HANDLE(_context)  MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(handle_mutex)
-
-#define MPIU_THREAD_CS_ENTER_HANDLEALLOC(_context) MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(handle_mutex)
-#define MPIU_THREAD_CS_EXIT_HANDLEALLOC(_context)  MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(handle_mutex)
-
-/* MPIDCOMM protects the progress engine and related code */
-#define MPIU_THREAD_CS_ENTER_MPIDCOMM(_context)                \
-    MPIU_THREAD_CHECK_BEGIN                                    \
-    do {                                                       \
-        MPIU_THREAD_CS_ENTER_LOCKNAME_RECURSIVE(global_mutex); \
-    } while (0);                                               \
-    MPIU_THREAD_CHECK_END
-#define MPIU_THREAD_CS_EXIT_MPIDCOMM(_context)                \
-    MPIU_THREAD_CHECK_BEGIN                                   \
-    do {                                                      \
-        MPIU_THREAD_CS_EXIT_LOCKNAME_RECURSIVE(global_mutex); \
-    } while (0);                                              \
-    MPIU_THREAD_CHECK_END
-#define MPIU_THREAD_CS_YIELD_MPIDCOMM(_context)                \
-    MPIU_THREAD_CHECK_BEGIN                                    \
-    do {                                                       \
-        MPIU_THREAD_CS_YIELD_LOCKNAME_RECURSIVE(global_mutex); \
-    } while (0);                                               \
-    MPIU_THREAD_CHECK_END
-
-#define MPIU_THREAD_CS_ENTER_COMPLETION(_context) MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(completion_mutex)
-#define MPIU_THREAD_CS_EXIT_COMPLETION(_context)  MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(completion_mutex)
-
-
-/* MT FIXME the following description is almost right, but it needs minor
- * updates and revision to account for the COMPLETION CS and other issues in the
- * request */
-/* The fine-grained locking discipline for requests is unfortunately complicated:
- *
- * (1) Raw allocation and deallocation of requests is protected internally by
- * the HANDLEALLOC critical section.  This is currently the same as the HANDLE
- * CS, not sure why we have both...
- *
- * (2) Once allocated, a directly allocated request is intially held exclusively
- * by a single thread.  Direct allocation is common for send requests, but recv
- * requests are usually created differently.
- *
- * (3) Most receive requests are created as the result of a call to FDP_or_AEU
- * or FDU_or_AEP.  Calls to these functions (along with the other receive queue
- * functions) must be inside a MSGQUEUE CS.  This CS protects the queue data
- * structures as well as any fields inside the requests while they are in the
- * queue.  For example, assume a call to FDU_or_AEP, as in MPID_Recv.  If the
- * FDU case hits, the MSGQUEUE CS may be released immediately after the call.
- * If the AEP case hits, however, the MSGQUEUE CS must remain held until any
- * request field manipulation (such as dev.recv_pending_count) is complete.
- *
- * (4) In both the send and receive request cases, there is usually a particular
- * thread in some upper-level code (e.g. MPI_Send) with interest in the
- * completion of the request.  This may or may not be a thread that is also
- * making progress on this request (often not).  The upper level code must not
- * attempt to access any request fields (such as the status) until completion is
- * signalled by the lower layer.
- *
- * (5) Once removed from the receive queue, the request is once again
- * exclusively owned by the dequeuing thread.  From here, the dequeuing thread
- * may do whatever it wants with the request without holding any CS, until it
- * signals the request's completion.  Signalling completion indicates that the
- * thread in the upper layer polling on it may access the rest of the fields in
- * the request.  This completion signalling is lock-free and must be implemented
- * carefully to work correctly in the face of optimizing compilers and CPUs.
- * The upper-level thread now wholly owns the request until it is deallocated.
- *
- * (6) In ch3:nemesis at least, multithreaded access to send requests is managed
- * by the MPIDCOMM (progress engine) CS.  The completion signalling pattern
- * applies here (think MPI_Isend/MPI_Wait).
- *
- * (7) Request cancellation is tricky-ish.  For send cancellation, it is
- * possible that the completion counter is actually *incremented* because a
- * pkt is sent to the recipient asking for remote cancellation.  By asking for
- * cancellation (of any kind of req), the upper layer gives up its exclusive
- * access to the request and must wait for the completion counter to drop to 0
- * before exclusively accessing the request fields.
- *
- * The completion counter is a reference count, much like the object liveness
- * reference count.  However it differs from a normal refcount because of
- * guarantees in the MPI Standard.  Applications must not attempt to complete
- * (wait/test/free) a given request concurrently in two separate threads.  So
- * checking for cc==0 is safe because only one thread is ever allowed to make
- * that check.
- *
- * A non-zero completion count must always be accompanied by a normal reference
- * that is logically held by the progress engine.  Similarly, once the
- * completion counter drops to zero, the progress engine is expected to release
- * its reference.
- */
-/* lock ordering: if MPIDCOMM+MSGQUEUE must be aquired at the same time, then
- * the order should be to acquire MPIDCOMM first, then MSGQUEUE.  Release in
- * reverse order. */
-#define MPIU_THREAD_CS_ENTER_MSGQUEUE(context_)           \
-    do {                                                  \
-        MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(msgq_mutex) \
-        MPIU_THREAD_CS_ASSERT_ENTER_HELPER(MSGQUEUE);     \
-    } while (0)
-#define MPIU_THREAD_CS_EXIT_MSGQUEUE(context_)            \
-    do {                                                  \
-        MPIU_THREAD_CS_ASSERT_EXIT_HELPER(MSGQUEUE);      \
-        MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(msgq_mutex)  \
-    } while (0)
-
-/* change to 1 to enable some iffy CS assert_held logic */
-#if 0
-#define MPIU_THREAD_CS_ASSERT_HELD(name_)                                                      \
-    do {                                                                                       \
-        int same = FALSE;                                                                      \
-        MPID_Thread_id_t me;                                                                   \
-        if (MPIU_ISTHREADED) {                                                                 \
-            MPID_Thread_self(&me);                                                                 \
-            MPID_Thread_same(&me, &MPIR_ThreadInfo.cs_holder[MPIU_THREAD_CS_NAME_##name_], &same); \
-            MPIU_Assert_fmt_msg(same, ("me=%#08x holder=%#08x",                                              \
-                                       ((unsigned)(size_t)me),                                                       \
-                                       ((unsigned)(size_t)MPIR_ThreadInfo.cs_holder[MPIU_THREAD_CS_NAME_##name_]))); \
-        }                                                                                      \
-    } while (0)
-
-/* MT FIXME buggy, these defs don't work with recursive mutexes as implemented */
-#define MPIU_THREAD_CS_ASSERT_ENTER_HELPER(name_)                                                        \
-    do {                                                                                                 \
-        MPID_Thread_self(&MPIR_ThreadInfo.cs_holder[MPIU_THREAD_CS_NAME_##name_]);                       \
-    } while (0)
-#define MPIU_THREAD_CS_ASSERT_EXIT_HELPER(name_)                                                         \
-    do {                                                                                                 \
-        /* FIXME hack, assumes all 0-bytes won't be a valid thread ID */                                 \
-        memset(&MPIR_ThreadInfo.cs_holder[MPIU_THREAD_CS_NAME_##name_], 0x00, sizeof(MPID_Thread_id_t)); \
-    } while (0)
-#endif
-
-/* MT FIXME should this CS share the global_mutex?  If yes, how do
- * we avoid accidental deadlock? */
-#define MPIU_THREAD_CS_ENTER_INITFLAG(_context) MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(global_mutex)
-#define MPIU_THREAD_CS_EXIT_INITFLAG(_context)  MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(global_mutex)
-
-#define MPIU_THREAD_CS_ENTER_PMI(_context) MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(pmi_mutex)
-#define MPIU_THREAD_CS_EXIT_PMI(_context)  MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(pmi_mutex)
-
-#define MPIU_THREAD_CS_ENTER_CONTEXTID(_context) MPIU_THREAD_CS_ENTER_LOCKNAME_CHECKED(ctx_mutex)
-#define MPIU_THREAD_CS_EXIT_CONTEXTID(_context)  MPIU_THREAD_CS_EXIT_LOCKNAME_CHECKED(ctx_mutex)
-#define MPIU_THREAD_CS_YIELD_CONTEXTID(_context) MPIU_THREAD_CS_YIELD_LOCKNAME_CHECKED(ctx_mutex)
-
-/* must include semicolon */
-#define MPIU_THREAD_OBJECT_HOOK MPID_Thread_mutex_t pobj_mutex;
-
-#define MPIU_THREAD_CS_ENTER_MPI_OBJ(context_)                      \
-    do {                                                            \
-        if (MPIU_ISTHREADED)                                        \
-            MPID_Thread_mutex_lock(&context_->pobj_mutex);          \
-    } while (0)
-#define MPIU_THREAD_CS_EXIT_MPI_OBJ(context_)                       \
-    do {                                                            \
-        if (MPIU_ISTHREADED)                                        \
-            MPID_Thread_mutex_unlock(&context_->pobj_mutex);        \
-    } while (0)
-
-/* initialize any per-object mutex in an MPI handle allocated object.  Mainly
- * provided to reduce the amount of #ifdef/#endif code outside of this file. */
-#define MPIU_THREAD_MPI_OBJ_INIT(objptr_)                        \
-    do {                                                         \
-        int err_ = 0;                                            \
-        MPID_Thread_mutex_create(&(objptr_)->pobj_mutex, &err_); \
-        MPIU_Assert(!err_);                                      \
-    } while (0)
-
-#define MPIU_THREAD_MPI_OBJ_FINALIZE(objptr_)                    \
-    do {                                                         \
-        int err;                                                 \
-        MPID_Thread_mutex_destroy(&(objptr_)->pobj_mutex, &err); \
-        MPIU_Assert(!err);                                       \
-    } while (0)                                                  \
-
-
-#elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_LOCK_FREE
-/* Updates to shared data and access to shared services is handled without
-   locks where ever possible. */
-#error lock-free not yet implemented
-
-#else
-#error Unrecognized thread granularity
-#endif
-
-#elif !defined(MPID_DEVICE_DEFINES_THREAD_CS) /* && !defined(MPICH_IS_THREADED) */
-#define MPIU_THREAD_CS_INIT
-#define MPIU_THREAD_CS_FINALIZE
-#define MPIU_THREAD_CS_ENTER(_name,_context) do{/*nothing*/}while(0)
-#define MPIU_THREAD_CS_EXIT(_name,_context)  do{/*nothing*/}while(0)
-#define MPIU_THREAD_CS_YIELD(_name,_context) do{/*nothing*/}while(0)
-#endif /* MPICH_IS_THREADED */
-
-/* catch-all */
-#ifndef MPIU_THREAD_OBJECT_HOOK
-#  define MPIU_THREAD_OBJECT_HOOK /**/
-#  define MPIU_THREAD_OBJECT_HOOK_INIT /**/
-#endif
-
-#ifndef MPIU_THREAD_CS_ASSERT_HELD
-#define MPIU_THREAD_CS_ASSERT_HELD(name_) do{/*nothing*/}while(0)
-#define MPIU_THREAD_CS_ASSERT_ENTER_HELPER(name_)
-#define MPIU_THREAD_CS_ASSERT_EXIT_HELPER(name_)
-#endif
-
-
-/* define a type for the completion counter */
-#if defined(MPICH_IS_THREADED)
-# if MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_GLOBAL
-
-/* memory barriers aren't needed in this impl, because all access to completion
- * counters is done while holding the ALLFUNC critical section */
-typedef volatile int MPID_cc_t;
-#  define MPID_cc_set(cc_ptr_, val_) (*(cc_ptr_)) = (val_)
-#  define MPID_cc_is_complete(cc_ptr_) (0 == *(cc_ptr_))
-#define MPID_cc_decr(cc_ptr_, incomplete_)     \
-do {                                           \
-    *(incomplete_) = --(*(cc_ptr_));           \
-} while (0)
-#define MPID_cc_incr(cc_ptr_, was_incomplete_) \
-do {                                           \
-    *(was_incomplete_) = (*(cc_ptr_))++;       \
-} while (0)
-#define MPID_cc_get(cc_) (cc_)
-
-# elif MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT
-
-#include "opa_primitives.h"
-
-typedef OPA_int_t MPID_cc_t;
-
-/* implies no barrier, since this routine should only be used for request
- * initialization */
-static inline void MPID_cc_set(MPID_cc_t *cc_ptr, int val)
-{
-    if (val == 0) {
-        /* values other than 0 do not enforce any ordering, and therefore do not
-         * start a HB arc */
-        /* MT FIXME using cc_set in this way is sloppy.  Sometimes the caller
-         * really does know that the cc value may cleared, but more likely this
-         * is just a hack to avoid the work of figuring out what the cc value
-         * currently is and decrementing it instead. */
-        /* barrier ensures that any state written before indicating completion is
-         * seen by the thread polling on the cc.  If OPA adds store-release
-         * semantics, we can convert to that instead. */
-        OPA_write_barrier();
-        MPL_VG_ANNOTATE_HAPPENS_BEFORE(cc_ptr);
-    }
-#if defined(MPL_VG_AVAILABLE)
-    /* MT subtle: store_int is actually safe to use, but Helgrind/DRD/TSan all
-     * view the store/load pair as a race.  Using an atomic operation for the
-     * store side makes all three happy.  DRD & TSan also support
-     * ANNOTATE_BENIGN_RACE, but Helgrind does not. */
-    OPA_swap_int(cc_ptr, val);
-#else
-    OPA_store_int(cc_ptr, val);
-#endif
-}
-
-ATTRIBUTE((unused))
-static MPL_DBG_INLINE_KEYWORD int MPID_cc_is_complete(MPID_cc_t *cc_ptr)
-{
-    int complete;
-    complete = (0 == OPA_load_int(cc_ptr));
-    if (complete) {
-        MPL_VG_ANNOTATE_HAPPENS_AFTER(cc_ptr);
-        OPA_read_barrier();
-    }
-    return complete;
-}
-
-/* incomplete_==TRUE iff the cc > 0 after the decr */
-#define MPID_cc_decr(cc_ptr_, incomplete_)                                  \
-    do {                                                                    \
-        OPA_write_barrier();                                                \
-        MPL_VG_ANNOTATE_HAPPENS_BEFORE(cc_ptr_);                            \
-        *(incomplete_) = !OPA_decr_and_test_int(cc_ptr_);                   \
-        /* TODO check if this HA is actually necessary */                   \
-        if (!*(incomplete_)) {                                              \
-            MPL_VG_ANNOTATE_HAPPENS_AFTER(cc_ptr_);                         \
-        }                                                                   \
-    } while (0)
-
-/* MT FIXME does this need a HB/HA annotation?  This macro is only used for
- * cancel_send right now. */
-/* was_incomplete_==TRUE iff the cc==0 before the decr */
-#define MPID_cc_incr(cc_ptr_, was_incomplete_)                              \
-    do {                                                                    \
-        *(was_incomplete_) = OPA_fetch_and_incr_int(cc_ptr_);               \
-    } while (0)
-
-#define MPID_cc_get(cc_) OPA_load_int(&(cc_))
-
-# else
-#  error "unexpected thread granularity"
-# endif /* granularity */
-#else /* !defined(MPICH_IS_THREADED) */
-
-typedef int MPID_cc_t;
-# define MPID_cc_set(cc_ptr_, val_) (*(cc_ptr_)) = (val_)
-# define MPID_cc_is_complete(cc_ptr_) (0 == *(cc_ptr_))
-#define MPID_cc_decr(cc_ptr_, incomplete_)     \
-do {                                           \
-    *(incomplete_) = --(*(cc_ptr_));           \
-} while (0)
-#define MPID_cc_incr(cc_ptr_, was_incomplete_) \
-do {                                           \
-    *(was_incomplete_) = (*(cc_ptr_))++;       \
-} while (0)
-#define MPID_cc_get(cc_) (cc_)
-
-#endif /* defined(MPICH_IS_THREADED) */
-
-
-/* "publishes" the obj with handle value (handle_) via the handle pointer
- * (hnd_lval_).  That is, it is a version of the following statement that fixes
- * memory consistency issues:
- *     (hnd_lval_) = (handle_);
- *
- * assumes that the following is always true: typeof(*hnd_lval_ptr_)==int
- */
-/* This could potentially be generalized beyond MPI-handle objects, but we
- * should only take that step after seeing good evidence of its use.  A general
- * macro (that is portable to non-gcc compilers) will need type information to
- * make the appropriate volatile cast. */
-/* Ideally _GLOBAL would use this too, but we don't want to count on OPA
- * availability in _GLOBAL mode.  Instead the ALLFUNC critical section should be
- * used. */
-#if defined(MPICH_IS_THREADED) && (MPIU_THREAD_GRANULARITY == MPIU_THREAD_GRANULARITY_PER_OBJECT)
-#define MPIU_OBJ_PUBLISH_HANDLE(hnd_lval_, handle_)                                 \
-    do {                                                                            \
-        if (MPIU_ISTHREADED) {                                                      \
-            /* wmb ensures all read-only object field values are seen before the */ \
-            /* handle value is seen at the application level */                     \
-            OPA_write_barrier();                                                    \
-            /* volatile ensures lval is not speculatively read or written */        \
-            *(volatile int *)&(hnd_lval_) = (handle_);                              \
-        }                                                                           \
-        else {                                                                      \
-            (hnd_lval_) = (handle_);                                                \
-        }                                                                           \
-    } while (0)
-#else
-#define MPIU_OBJ_PUBLISH_HANDLE(hnd_lval_, handle_)  \
-    do {                                             \
-        (hnd_lval_) = (handle_);                     \
-    } while (0)
-#endif
-
-#ifndef MPIU_THREAD_MPI_OBJ_INIT
-#define MPIU_THREAD_MPI_OBJ_INIT(objptr_) do {} while (0)
-#endif
-#ifndef MPIU_THREAD_MPI_OBJ_FINALIZE
-#define MPIU_THREAD_MPI_OBJ_FINALIZE(objptr_) do {} while (0)
-#endif
-
-#endif /* !defined(MPIIMPLTHREAD_H_INCLUDED) */
-
diff --git a/src/include/mpiimplthreadpost.h b/src/include/mpiimplthreadpost.h
deleted file mode 100644
index afdfa7f..0000000
--- a/src/include/mpiimplthreadpost.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
-/*
- *  (C) 2010 by Argonne National Laboratory.
- *      See COPYRIGHT in top-level directory.
- */
-
-/* this file contains definitions and declarations that would otherwise live in
- * mpiimplthread.h but must come later in the mpiimpl.h include process because
- * of the "big ball of wax" situation in our headers */
-
-#ifndef MPIIMPLTHREADPOST_H_INCLUDED
-#define MPIIMPLTHREADPOST_H_INCLUDED
-
-#if defined(MPICH_IS_THREADED) && !defined(MPID_DEVICE_DEFINES_THREAD_CS)
-/* All the funcs below require MPID Thread defns - that are available only
- * when thread level >= serialized
- */
-#undef FUNCNAME
-#define FUNCNAME MPIU_Thread_CS_enter_lockname_impl_
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
-/* these are inline functions instead of macros to avoid some of the
- * MPIU_THREADPRIV_DECL scoping issues */
-MPL_DBG_ATTRIBUTE_NOINLINE
-ATTRIBUTE((unused))
-static MPL_DBG_INLINE_KEYWORD void
-MPIU_Thread_CS_enter_lockname_impl_(enum MPIU_Nest_mutexes kind,
-                                    const char *lockname,
-                                    MPID_Thread_mutex_t *mutex)
-{
-    MPIU_THREADPRIV_DECL;
-    MPIU_THREADPRIV_GET;
-    MPIU_THREAD_CHECKDEPTH(kind, lockname, 0);
-    MPIU_DBG_MSG_S(THREAD,TYPICAL,"locking %s", lockname);
-    MPID_Thread_mutex_lock(mutex);
-    MPIU_THREAD_UPDATEDEPTH(kind, lockname, 1);
-}
-
-#undef FUNCNAME
-#define FUNCNAME MPIU_Thread_CS_exit_lockname_impl_
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
-MPL_DBG_ATTRIBUTE_NOINLINE
-ATTRIBUTE((unused))
-static MPL_DBG_INLINE_KEYWORD void
-MPIU_Thread_CS_exit_lockname_impl_(enum MPIU_Nest_mutexes kind,
-                                   const char *lockname,
-                                   MPID_Thread_mutex_t *mutex)
-{
-    MPIU_THREADPRIV_DECL;
-    MPIU_THREADPRIV_GET;
-    MPIU_THREAD_CHECKDEPTH(kind, lockname, 1);
-    MPIU_DBG_MSG_S(THREAD,TYPICAL,"unlocking %s", lockname);
-    MPID_Thread_mutex_unlock(mutex);
-    MPIU_THREAD_UPDATEDEPTH(kind, lockname, -1);
-}
-
-#undef FUNCNAME
-#define FUNCNAME MPIU_Thread_CS_yield_lockname_impl_
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
-MPL_DBG_ATTRIBUTE_NOINLINE
-ATTRIBUTE((unused))
-static MPL_DBG_INLINE_KEYWORD void
-MPIU_Thread_CS_yield_lockname_impl_(enum MPIU_Nest_mutexes kind,
-                                    const char *lockname,
-                                    MPID_Thread_mutex_t *mutex)
-{
-    MPIU_THREADPRIV_DECL;
-    MPIU_THREADPRIV_GET;
-    MPIU_THREAD_CHECKDEPTH(kind, lockname, 1);
-    MPID_Thread_yield(mutex);
-}
-
-/* ------------------------------------------------------------------- */
-/* recursive versions, these are for the few locks where it is difficult or
- * impossible to eliminate recursive locking usage */
-
-#undef FUNCNAME
-#define FUNCNAME MPIU_Thread_CS_enter_lockname_recursive_impl_
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
-/* these are inline functions instead of macros to avoid some of the
- * MPIU_THREADPRIV_DECL scoping issues */
-MPL_DBG_ATTRIBUTE_NOINLINE
-ATTRIBUTE((unused))
-static MPL_DBG_INLINE_KEYWORD void
-MPIU_Thread_CS_enter_lockname_recursive_impl_(enum MPIU_Nest_mutexes kind,
-                                              const char *lockname,
-                                              MPID_Thread_mutex_t *mutex)
-{
-    int depth;
-    MPIU_THREADPRIV_DECL;
-    MPIU_THREADPRIV_GET;
-    depth = MPIU_THREADPRIV_FIELD(lock_depth)[kind];
-    MPIU_DBG_MSG_D(THREAD,TYPICAL,"recursive enter, depth=%d", depth);
-
-    MPIU_Assert(depth >= 0 && depth < 10); /* probably a mismatch if we hit this */
-
-    if (depth == 0) {
-        MPIU_DBG_MSG_S(THREAD,TYPICAL,"locking %s", lockname);
-        MPID_Thread_mutex_lock(mutex);
-    }
-    MPIU_THREADPRIV_FIELD(lock_depth)[kind] += 1;
-}
-
-#undef FUNCNAME
-#define FUNCNAME MPIU_Thread_CS_try_lockname_recursive_impl_
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
-/* these are inline functions instead of macros to avoid some of the
- * MPIU_THREADPRIV_DECL scoping issues */
-MPL_DBG_ATTRIBUTE_NOINLINE
-ATTRIBUTE((unused))
-static MPL_DBG_INLINE_KEYWORD void
-MPIU_Thread_CS_try_lockname_recursive_impl_(enum MPIU_Nest_mutexes kind,
-                                            const char *lockname,
-                                            MPID_Thread_mutex_t *mutex,
-                                            int *locked)
-{
-    int depth,local_try;
-    MPIU_THREADPRIV_DECL;
-    MPIU_THREADPRIV_GET;
-    depth = MPIU_THREADPRIV_FIELD(lock_depth)[kind];
-    MPIU_DBG_MSG_D(THREAD,TYPICAL,"recursive enter, depth=%d", depth);
-
-    MPIU_Assert(depth >= 0 && depth < 10); /* probably a mismatch if we hit this */
-
-    *locked = FALSE;
-
-    if (depth == 0) {
-        MPIU_DBG_MSG_S(THREAD,TYPICAL,"locking %s", lockname);
-        MPID_Thread_mutex_trylock(mutex,&local_try);
-        if (local_try == TRUE) {
-           MPIU_THREADPRIV_FIELD(lock_depth)[kind] += 1;
-           *locked = local_try;
-        }
-    } else {
-        MPIU_THREADPRIV_FIELD(lock_depth)[kind] += 1;
-        *locked = 1;
-   }
-}
-
-#undef FUNCNAME
-#define FUNCNAME MPIU_Thread_CS_exit_lockname_recursive_impl_
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
-MPL_DBG_ATTRIBUTE_NOINLINE
-ATTRIBUTE((unused))
-static MPL_DBG_INLINE_KEYWORD void
-MPIU_Thread_CS_exit_lockname_recursive_impl_(enum MPIU_Nest_mutexes kind,
-                                             const char *lockname,
-                                             MPID_Thread_mutex_t *mutex)
-{
-    int depth;
-    MPIU_THREADPRIV_DECL;
-    MPIU_THREADPRIV_GET;
-    depth = MPIU_THREADPRIV_FIELD(lock_depth)[kind];
-    MPIU_DBG_MSG_D(THREAD,TYPICAL,"recursive exit, depth=%d", depth);
-
-    MPIU_Assert(depth > 0 && depth < 10); /* probably a mismatch if we hit this */
-
-    if (depth == 1) {
-        MPIU_DBG_MSG_S(THREAD,TYPICAL,"unlocking %s", lockname);
-        MPID_Thread_mutex_unlock(mutex);
-    }
-    MPIU_THREADPRIV_FIELD(lock_depth)[kind] -= 1;
-}
-
-#undef FUNCNAME
-#define FUNCNAME MPIU_Thread_CS_yield_lockname_recursive_impl_
-#undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
-MPL_DBG_ATTRIBUTE_NOINLINE
-ATTRIBUTE((unused))
-static MPL_DBG_INLINE_KEYWORD void
-MPIU_Thread_CS_yield_lockname_recursive_impl_(enum MPIU_Nest_mutexes kind,
-                                              const char *lockname,
-                                              MPID_Thread_mutex_t *mutex)
-{
-    int depth ATTRIBUTE((unused));
-    MPIU_THREADPRIV_DECL;
-    MPIU_THREADPRIV_GET;
-    depth = MPIU_THREADPRIV_FIELD(lock_depth)[kind];
-    MPIU_DBG_MSG_D(THREAD,TYPICAL,"recursive yield, depth=%d", depth);
-
-    MPIU_Assert(depth > 0 && depth < 10); /* we must hold the mutex */
-    /* no need to update depth, this is a thread-local value */
-
-    MPID_Thread_yield(mutex);
-}
-
-/* undef for safety, this is a commonly-included header */
-#undef FUNCNAME
-#undef FCNAME
-
-#endif /*  (MPICH_THREAD_LEVEL >= MPI_THREAD_SERIALIZED) */
-
-#endif /* defined(MPIIMPLTHREADPOST_H_INCLUDED) */
-
diff --git a/src/include/mpimem.h b/src/include/mpimem.h
index 1694bbc..cc4d1e0 100644
--- a/src/include/mpimem.h
+++ b/src/include/mpimem.h
@@ -88,11 +88,6 @@ char *MPIU_Strdup( const char * );
 #define MPIU_STR_FAIL      -1
 #define MPIU_STR_NOMEM      1
 
-/* FIXME: TRUE/FALSE definitions should either not be used or be
-   used consistently.  These also do not belong in the mpimem header file. */
-#define MPIU_TRUE  1
-#define MPIU_FALSE 0
-
 /* FIXME: Global types like this need to be discussed and agreed to */
 typedef int MPIU_BOOL;
 
@@ -420,7 +415,7 @@ if (pointer_) { \
     void *realloc_tmp_ = MPIU_Realloc((ptr_), (size_)); \
     if ((size_) && !realloc_tmp_) { \
         MPIU_Free(ptr_); \
-        MPIU_ERR_SETANDJUMP2(rc_,MPI_ERR_OTHER,"**nomem2","**nomem2 %d %s",(size_),MPIU_QUOTE(ptr_)); \
+        MPIR_ERR_SETANDJUMP2(rc_,MPI_ERR_OTHER,"**nomem2","**nomem2 %d %s",(size_),MPL_QUOTE(ptr_)); \
     } \
     (ptr_) = realloc_tmp_; \
 } while (0)
@@ -428,7 +423,7 @@ if (pointer_) { \
 #define MPIU_REALLOC_ORJUMP(ptr_,size_,rc_) do { \
     void *realloc_tmp_ = MPIU_Realloc((ptr_), (size_)); \
     if (size_) \
-        MPIU_ERR_CHKANDJUMP2(!realloc_tmp_,rc_,MPI_ERR_OTHER,"**nomem2","**nomem2 %d %s",(size_),MPIU_QUOTE(ptr_)); \
+        MPIR_ERR_CHKANDJUMP2(!realloc_tmp_,rc_,MPI_ERR_OTHER,"**nomem2","**nomem2 %d %s",(size_),MPL_QUOTE(ptr_)); \
     (ptr_) = realloc_tmp_; \
 } while (0)
 
@@ -455,13 +450,6 @@ void MPIU_Basename(char *path, char **basename);
       ((char *)(b_) >= (char *)(a_) && ((char *)(b_) < ((char *)(a_) + (a_len_)))) )
 #if (!defined(NDEBUG) && defined(HAVE_ERROR_CHECKING))
 
-#ifndef TRUE
-#define TRUE 1
-#endif
-#ifndef FALSE
-#define FALSE 0
-#endif
-
 /* May be used to perform sanity and range checking on memcpy and mempcy-like
    function calls.  This macro will bail out much like an MPIU_Assert if any of
    the checks fail. */
diff --git a/src/include/mpir_nbc.h b/src/include/mpir_nbc.h
index d9c3224..0e615e9 100644
--- a/src/include/mpir_nbc.h
+++ b/src/include/mpir_nbc.h
@@ -77,12 +77,12 @@ int MPID_Sched_copy(const void *inbuf,  int incount,  MPI_Datatype intype,
 int MPID_Sched_barrier(MPID_Sched_t s);
 
 /* A convenience macro for the extremely common case that "mpi_errno" is the
- * variable used for tracking error state and MPIU_ERR_POP is needed.  This
+ * variable used for tracking error state and MPIR_ERR_POP is needed.  This
  * declutters the NBC code substantially. */
 #define MPID_SCHED_BARRIER(sched_)              \
     do {                                        \
         mpi_errno = MPID_Sched_barrier(sched_); \
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno); \
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno); \
     } while (0)
 
 /* Defers evaluating (*count) until the entry actually begins to execute.  This
@@ -151,7 +151,7 @@ int MPIR_Sched_cb_free_buf(MPID_Comm *comm, int tag, void *state);
             mpi_errno = MPID_Sched_cb(&MPIR_Sched_cb_free_buf,                                 \
                                       (mpir_sched_chkpmem_stk_[--mpir_sched_chkpmem_stk_sp_]), \
                                       (sched_));                                               \
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);                                            \
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);                                            \
         }                                                                                      \
     } while (0)
 
diff --git a/src/include/mpishared.h b/src/include/mpishared.h
index 16cf8ed..4231d53 100644
--- a/src/include/mpishared.h
+++ b/src/include/mpishared.h
@@ -54,9 +54,6 @@
 #define MPI_THREAD_MULTIPLE 3
 #endif
 
-/* For thread support */
-#include "mpiimplthread.h"
-
 /* Error reporting routines */
 #include "mpierror.h"
 #include "mpierrs.h"
@@ -135,6 +132,4 @@
 #define MPIU_UNREFERENCED_ARG(a)
 #endif
 
-#include "mpiimplthreadpost.h"
-
 #endif
diff --git a/src/include/mpitimpl.h b/src/include/mpitimpl.h
index 75b72fb..48bf02b 100644
--- a/src/include/mpitimpl.h
+++ b/src/include/mpitimpl.h
@@ -11,9 +11,9 @@
 #define MPITIMPL_H_INCLUDED
 
 #include "mpi.h"
+#include "mpiutil.h"
 #include "mpiu_utarray.h"
 #include "mpiu_uthash.h"
-#include "mpiimplthread.h" /* For MPICH_IS_THREADED */
 
 #ifdef HAVE_ERROR_CHECKING
 typedef enum {
@@ -1411,15 +1411,17 @@ extern MPIU_Thread_mutex_t mpi_t_mutex;
 
 #define MPIR_T_THREAD_CS_ENTER() \
     do { \
-        MPIR_T_THREAD_CHECK_BEGIN \
-        MPID_Thread_mutex_lock(&mpi_t_mutex); \
+        int err;                              \
+        MPIR_T_THREAD_CHECK_BEGIN             \
+            MPID_Thread_mutex_lock(&mpi_t_mutex,&err);  \
         MPIR_T_THREAD_CHECK_END \
     } while (0)
 
 #define MPIR_T_THREAD_CS_EXIT() \
     do { \
+        int err;                  \
         MPIR_T_THREAD_CHECK_BEGIN \
-        MPID_Thread_mutex_unlock(&mpi_t_mutex); \
+            MPID_Thread_mutex_unlock(&mpi_t_mutex,&err);  \
         MPIR_T_THREAD_CHECK_END \
     } while (0)
 #else /* !MPICH_IS_THREADED */
diff --git a/src/include/mpiutil.h b/src/include/mpiutil.h
index 96768de..18937de 100644
--- a/src/include/mpiutil.h
+++ b/src/include/mpiutil.h
@@ -10,350 +10,8 @@
 #include "mpiu_thread.h"
 #include "mpiu_type_defs.h"
 #include "mpidbg.h"
-
-/*
-=== BEGIN_MPI_T_CVAR_INFO_BLOCK ===
-
-cvars:
-    - name        : MPIR_CVAR_POLLS_BEFORE_YIELD
-      category    : NEMESIS
-      type        : int
-      default     : 1000
-      class       : none
-      verbosity   : MPI_T_VERBOSITY_USER_BASIC
-      scope       : MPI_T_SCOPE_ALL_EQ
-      description : >-
-        When MPICH is in a busy waiting loop, it will periodically
-        call a function to yield the processor.  This cvar sets
-        the number of loops before the yield function is called.  A
-        value of 0 disables yielding.
-
-=== END_MPI_T_CVAR_INFO_BLOCK ===
-*/
-
-/* -------------------------------------------------------------------------- */
-/* detect compiler characteristics from predefined preprocesor tokens */
-
-/* modern versions of clang support lots of C11 features */
-#if defined(__has_extension)
-#  if __has_extension(c_generic_selections)
-#    define HAVE_C11__GENERIC 1
-#  endif
-#  if __has_extension(c_static_assert)
-#    define HAVE_C11__STATIC_ASSERT 1
-#  endif
-#endif
-
-/* GCC 4.6 added support for _Static_assert:
- * http://gcc.gnu.org/gcc-4.6/changes.html */
-#if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && !defined __cplusplus
-#  define HAVE_C11__STATIC_ASSERT 1
-#endif
-
-/* -------------------------------------------------------------------------- */
-
-/*
- * MPIU_Busy_wait()
- *
- * Call this in every busy wait loop to periodically yield the processor.  The
- * MPIR_CVAR_POLLS_BEFORE_YIELD parameter can be used to adjust the number of
- * times MPIU_Busy_wait is called before the yield function is called.
- */
-#ifdef USE_NOTHING_FOR_YIELD
-/* optimize if we're not yielding the processor */
-#define MPIU_Busy_wait() do {} while (0)
-#else
-/* MT: Updating the static int poll_count variable isn't thread safe and will
-   need to be changed for fine-grained multithreading.  A possible alternative
-   is to make it a global thread-local variable. */
-#define MPIU_Busy_wait() do {                                   \
-        if (MPIR_CVAR_POLLS_BEFORE_YIELD) {                    \
-            static int poll_count_ = 0;                         \
-            if (poll_count_ >= MPIR_CVAR_POLLS_BEFORE_YIELD) { \
-                poll_count_ = 0;                                \
-                MPIU_PW_Sched_yield();                          \
-            } else {                                            \
-                ++poll_count_;                                  \
-            }                                                   \
-        }                                                       \
-    } while (0)
-#endif
-
-/* prototypes for assertion implementation helpers */
-int MPIR_Assert_fail(const char *cond, const char *file_name, int line_num);
-int MPIR_Assert_fail_fmt(const char *cond, const char *file_name, int line_num, const char *fmt, ...);
-
-/*
- * MPIU_Assert()
- *
- * Similar to assert() except that it performs an MPID_Abort() when the 
- * assertion fails.  Also, for Windows, it doesn't popup a
- * mesage box on a remote machine.
- *
- * MPIU_AssertDecl may be used to include declarations only needed
- * when MPIU_Assert is non-null (e.g., when assertions are enabled)
- */
-#if (!defined(NDEBUG) && defined(HAVE_ERROR_CHECKING))
-#   define MPIU_AssertDecl(a_) a_
-#   define MPIU_AssertDeclValue(_a,_b) _a = _b
-#   define MPIU_Assert(a_)                             \
-    do {                                               \
-        if (unlikely(!(a_))) {                         \
-            MPIR_Assert_fail(#a_, __FILE__, __LINE__); \
-        }                                              \
-    } while (0)
-#else
-#   define MPIU_Assert(a_)
-/* Empty decls not allowed in C */
-#   define MPIU_AssertDecl(a_) a_ 
-#   define MPIU_AssertDeclValue(_a,_b) _a ATTRIBUTE((unused)) = _b
-#endif
-
-/*
- * MPIU_Assertp()
- *
- * Similar to MPIU_Assert() except that these assertions persist regardless of 
- * NDEBUG or HAVE_ERROR_CHECKING.  MPIU_Assertp() may
- * be used for error checking in prototype code, although it should be 
- * converted real error checking and reporting once the
- * prototype becomes part of the official and supported code base.
- */
-#define MPIU_Assertp(a_)                                             \
-    do {                                                             \
-        if (unlikely(!(a_))) {                                       \
-            MPIR_Assert_fail(#a_, __FILE__, __LINE__);               \
-        }                                                            \
-    } while (0)
-
-/* Define the MPIU_Assert_fmt_msg macro.  This macro takes two arguments.  The
- * first is the condition to assert.  The second is a parenthesized list of
- * arguments suitable for passing directly to printf that will yield a relevant
- * error message.  The macro will first evaluate the condition.  If it evaluates
- * to false the macro will take four steps:
- *
- * 1) It will emit an "Assertion failed..." message in the valgrind output with
- *    a backtrace, if valgrind client requests are available and the process is
- *    running under valgrind.  It will also evaluate and print the supplied
- *    message.
- * 2) It will emit an "Assertion failed..." message via MPL_internal_error_printf.
- *    The supplied error message will also be evaluated and printed.
- * 3) It will similarly emit the assertion failure and caller supplied messages
- *    to the debug log, if enabled, via MPIU_DBG_MSG_FMT.
- * 4) It will invoke MPID_Abort, just like the other MPIU_Assert* macros.
- *
- * If the compiler doesn't support (...)/__VA_ARGS__ in macros then the user
- * message will not be evaluated or printed.  If NDEBUG is defined or
- * HAVE_ERROR_CHECKING is undefined, this macro will expand to nothing, just
- * like MPIU_Assert.
- *
- * Example usage:
- *
- * MPIU_Assert_fmg_msg(foo > bar,("foo is larger than bar: foo=%d bar=%d",foo,bar));
- */
-#if (!defined(NDEBUG) && defined(HAVE_ERROR_CHECKING))
-#  if defined(HAVE_MACRO_VA_ARGS)
-
-/* newlines are added internally by the impl function, callers do not need to include them */
-#    define MPIU_Assert_fmt_msg(cond_,fmt_arg_parens_)                         \
-    do {                                                                       \
-        if (unlikely(!(cond_))) {                                              \
-            MPIR_Assert_fail_fmt(#cond_, __FILE__, __LINE__,                   \
-                                 MPIU_Assert_fmt_msg_expand_ fmt_arg_parens_); \
-        }                                                                      \
-    } while (0)
-/* helper to just expand the parens arg inline */
-#    define MPIU_Assert_fmt_msg_expand_(...) __VA_ARGS__
-
-#  else /* defined(HAVE_MACRO_VA_ARGS) */
-
-#    define MPIU_Assert_fmt_msg(cond_,fmt_arg_parens_)                                                   \
-    do {                                                                                                 \
-        if (unlikely(!(cond_))) {                                                                        \
-            MPIR_Assert_fail_fmt(#cond_, __FILE__, __LINE__,                                             \
-                                 "%s", "macro __VA_ARGS__ not supported, unable to print user message"); \
-        }                                                                                                \
-    } while (0)
-
-#  endif
-#else /* !defined(NDEBUG) && defined(HAVE_ERROR_CHECKING) */
-#    define MPIU_Assert_fmt_msg(cond_,fmt_arg_parens_)
-#endif
-
-
-/* evaluates to TRUE if ((a_)*(b_)>(max_)), only detects overflow for positive
- * a_ and _b. */
-#define MPIU_Prod_overflows_max(a_, b_, max_) \
-    ( (a_) > 0 && (b_) > 0 && ((a_) > ((max_) / (b_))) )
-
-/* asserts that ((a_)*(b_)<=(max_)) holds in a way that is robust against
- * undefined integer overflow behavior and is suitable for both signed and
- * unsigned math (only suitable for positive values of (a_) and (b_)) */
-#define MPIU_Assert_prod_pos_overflow_safe(a_, b_, max_)                               \
-    MPIU_Assert_fmt_msg(!MPIU_Prod_overflows_max((a_),(b_),(max_)),                    \
-                        ("overflow detected: (%llx * %llx) > %s", (a_), (b_), #max_)); \
-
-
-/* Helper macros that give us a crude version of C++'s
- * "std::numeric_limits<TYPE>" functionality.  These rely on either C11
- * "_Generic" functionality or some unfortunately complicated GCC builtins. */
-#if defined(HAVE_C11__GENERIC)
-#define expr_inttype_max(expr_)              \
-    _Generic(expr_,                          \
-             signed char:        SCHAR_MAX,  \
-             signed short:       SHRT_MAX,   \
-             signed int:         INT_MAX,    \
-             signed long:        LONG_MAX,   \
-             signed long long:   LLONG_MAX,  \
-             unsigned char:      UCHAR_MAX,  \
-             unsigned short:     USHRT_MAX,  \
-             unsigned int:       UINT_MAX,   \
-             unsigned long:      ULONG_MAX,  \
-             unsigned long long: ULLONG_MAX,\
-             /* _Generic cares about cv-qualifiers */ \
-             volatile signed int:   INT_MAX,          \
-             volatile unsigned int: UINT_MAX)
-#define expr_inttype_min(expr_)             \
-    _Generic(expr_,                         \
-             signed char:        SCHAR_MIN, \
-             signed short:       SHRT_MIN,  \
-             signed int:         INT_MIN,   \
-             signed long:        LONG_MIN,  \
-             signed long long:   LLONG_MIN, \
-             unsigned char:      0,         \
-             unsigned short:     0,         \
-             unsigned int:       0,         \
-             unsigned long:      0,         \
-             unsigned long long: 0,         \
-             /* _Generic cares about cv-qualifiers */ \
-             volatile signed int:   INT_MIN,          \
-             volatile unsigned int: 0)
-#endif
-
-/* Assigns (src_) to (dst_), checking that (src_) fits in (dst_) without
- * truncation.
- *
- * When fiddling with this macro, please keep C's overly complicated integer
- * promotion/truncation/conversion rules in mind.  A discussion of these issues
- * can be found in Chapter 5 of "Secure Coding in C and C++" by Robert Seacord.
- */
-#define MPIU_Assign_trunc(dst_,src_,dst_type_)                                         \
-    do {                                                                               \
-        /* will catch some of the cases if the expr_inttype macros aren't available */ \
-        MPIU_Assert((src_) == (dst_type_)(src_));                                      \
-        dst_ = (dst_type_)(src_);                                                      \
-    } while (0)
-
-/*
- * Ensure an MPI_Aint value fits into a signed int.
- * Useful for detecting overflow when MPI_Aint is larger than an int.
- *
- * \param[in]  aint  Variable of type MPI_Aint
- */
-#define MPIU_Ensure_Aint_fits_in_int(aint) \
-  MPIU_Assert((aint) == (MPI_Aint)(int)(aint));
-
-/*
- * Ensure an MPI_Aint value fits into an unsigned int.
- * Useful for detecting overflow when MPI_Aint is larger than an 
- * unsigned int.
- *
- * \param[in]  aint  Variable of type MPI_Aint
- */
-#define MPIU_Ensure_Aint_fits_in_uint(aint) \
-  MPIU_Assert((aint) == (MPI_Aint)(unsigned int)(aint));
-
-/*
- * Ensure an MPI_Aint value fits into a pointer.
- * Useful for detecting overflow when MPI_Aint is larger than a pointer.
- *
- * \param[in]  aint  Variable of type MPI_Aint
- */
-#define MPIU_Ensure_Aint_fits_in_pointer(aint) \
-  MPIU_Assert((aint) == (MPI_Aint)(MPIU_Upint) MPI_AINT_CAST_TO_VOID_PTR(aint));
-
-/* -------------------------------------------------------------------------- */
-/* static assertions
- *
- * C11 adds static assertions.  They can be faked in pre-C11 compilers through
- * various tricks as long as you are willing to accept some ugly error messages
- * when the assert trips.  See
- * http://www.pixelbeat.org/programming/gcc/static_assert.html
- * for some implementation options.
- *
- * For now, we just use some simple preprocessor tests to use real static
- * assertions when the compiler supports them (modern clang and gcc do).
- * Eventually add configure logic to detect this.
- */
-/* the case we usually want to hit */
-#ifdef HAVE_C11__STATIC_ASSERT
-#  define MPIU_Static_assert(cond_,msg_) _Static_assert(cond_,msg_)
-#endif
-/* fallthrough to a run-time assertion */
-#ifndef MPIU_Static_assert
-#  define MPIU_Static_assert(cond_,msg_) MPIU_Assert_fmt_msg((cond_), ("%s", (msg_)))
-#endif
-
-/* -------------------------------------------------------------------------- */
-/* static type checking macros */
-
-/* implement using C11's "_Generic" functionality (optimal case) */
-#ifdef HAVE_C11__GENERIC
-#  define MPIU_Assert_has_type(expr_,type_) \
-    MPIU_Static_assert(_Generic((expr_), type_: 1, default: 0), \
-                       "expression '" #expr_ "' does not have type '" #type_ "'")
-#endif
-/* fallthrough to do nothing */
-#ifndef MPIU_Assert_has_type
-#  define MPIU_Assert_has_type(expr_,type_) do {} while (0)
-#endif
-
-/* -------------------------------------------------------------------------- */
-/*
- * Basic utility macros
- */
-#define MPIU_QUOTE(A) MPIU_QUOTE2(A)
-#define MPIU_QUOTE2(A) #A
-
-/* This macro is used to silence warnings from the Mac OS X linker when
- * an object file "has no symbols".  The unused attribute prevents a
- * warning about the unused dummy variable while the used attribute
- * prevents the compiler from discarding the symbol altogether.  This
- * macro should be used at the top of any file that might not define any
- * other variables or functions (perhaps due to conditional compilation
- * via the preprocessor).  A semicolon is expected after each invocation
- * of this macro. */
-#define MPIU_SUPPRESS_OSX_HAS_NO_SYMBOLS_WARNING \
-    static int MPIU_UNIQUE_SYMBOL_NAME(dummy) ATTRIBUTE((unused,used)) = 0
-
-/* we jump through a couple of extra macro hoops to append the line
- * number to the variable name in order to reduce the chance of a name
- * collision with headers that might be included in the translation
- * unit */
-#define MPIU_UNIQUE_SYMBOL_NAME(prefix_) MPIU_UNIQUE_IMPL1_(prefix_##_unique_L,__LINE__)
-#define MPIU_UNIQUE_IMPL1_(prefix_,line_) MPIU_UNIQUE_IMPL2_(prefix_,line_)
-#define MPIU_UNIQUE_IMPL2_(prefix_,line_) MPIU_UNIQUE_IMPL3_(prefix_,line_)
-#define MPIU_UNIQUE_IMPL3_(prefix_,line_) prefix_##line_
-
-/* These likely/unlikely macros provide static branch prediction hints to the
- * compiler, if such hints are available.  Simply wrap the relevant expression in
- * the macro, like this:
- *
- * if (unlikely(ptr == NULL)) {
- *     // ... some unlikely code path ...
- * }
- *
- * They should be used sparingly, especially in upper-level code.  It's easy to
- * incorrectly estimate branching likelihood, while the compiler can often do a
- * decent job if left to its own devices.
- *
- * These macros are not namespaced because the namespacing is cumbersome.
- */
-#ifdef HAVE_BUILTIN_EXPECT
-#  define unlikely(x_) __builtin_expect(!!(x_),0)
-#  define likely(x_)   __builtin_expect(!!(x_),1)
-#else
-#  define unlikely(x_) (x_)
-#  define likely(x_)   (x_)
-#endif
+#include "mpiassert.h"
+#include "mpiu_timer.h"
+#include "mpiu_pointer.h"
 
 #endif /* !defined(MPIUTIL_H_INCLUDED) */
diff --git a/src/include/rlog.h b/src/include/rlog.h
index b46523c..4908e63 100644
--- a/src/include/rlog.h
+++ b/src/include/rlog.h
@@ -17,12 +17,6 @@ extern "C" {
 #ifndef RLOG_BOOL
 #define RLOG_BOOL int
 #endif
-#ifndef RLOG_TRUE
-#define RLOG_TRUE 1
-#endif
-#ifndef RLOG_FALSE
-#define RLOG_FALSE 0
-#endif
 
 #define RLOG_BUFFSIZE           (8*1024*1024)
 #define RLOG_MAX_RECORD_SIZE     1024
diff --git a/src/include/rlog_macros.h b/src/include/rlog_macros.h
index 597a6bc..ccb8b11 100644
--- a/src/include/rlog_macros.h
+++ b/src/include/rlog_macros.h
@@ -8,7 +8,7 @@
 #define RLOG_MACROS_H_INCLUDED
 
 #include "rlog.h"
-#include "mpichtimer.h"
+#include "mpiu_timer.h"
 
 #ifndef MPIDM_Wtime_todouble
 #error Failed to select a defintion for MPIDM_Wtime_todouble
diff --git a/src/mpi/attr/attr_delete.c b/src/mpi/attr/attr_delete.c
index 1e624f9..fa93ba3 100644
--- a/src/mpi/attr/attr_delete.c
+++ b/src/mpi/attr/attr_delete.c
@@ -62,7 +62,7 @@ int MPI_Attr_delete(MPI_Comm comm, int keyval)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ATTR_DELETE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -105,7 +105,7 @@ int MPI_Attr_delete(MPI_Comm comm, int keyval)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ATTR_DELETE);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/attr_get.c b/src/mpi/attr/attr_get.c
index 1851e52..a318284 100644
--- a/src/mpi/attr/attr_get.c
+++ b/src/mpi/attr/attr_get.c
@@ -80,7 +80,7 @@ int MPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ATTR_GET);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -95,7 +95,7 @@ int MPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag)
 	       should have been used.  We can test for this specific
 	       case.  Note that this code assumes sizeof(MPIU_Pint) is 
 	       a power of 2. */
-            MPIU_ERR_CHKANDJUMP((MPIU_Pint)attribute_val & (sizeof(MPIU_Pint)-1),
+            MPIR_ERR_CHKANDJUMP((MPIU_Pint)attribute_val & (sizeof(MPIU_Pint)-1),
                                 mpi_errno,MPI_ERR_ARG,"**attrnotptr");
 #           endif
         }
@@ -130,7 +130,7 @@ int MPI_Attr_get(MPI_Comm comm, int keyval, void *attribute_val, int *flag)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ATTR_GET);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/attr_put.c b/src/mpi/attr/attr_put.c
index 89987fd..adb491b 100644
--- a/src/mpi/attr/attr_put.c
+++ b/src/mpi/attr/attr_put.c
@@ -79,7 +79,7 @@ int MPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_ATTR_PUT);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -121,7 +121,7 @@ int MPI_Attr_put(MPI_Comm comm, int keyval, void *attribute_val)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_ATTR_PUT);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/attrutil.c b/src/mpi/attr/attrutil.c
index 4658657..656915d 100644
--- a/src/mpi/attr/attrutil.c
+++ b/src/mpi/attr/attrutil.c
@@ -63,7 +63,7 @@ void MPID_Attr_free(MPID_Attribute *attr_ptr)
 #undef FUNCNAME
 #define FUNCNAME MPIR_Call_attr_delete
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*
   This function deletes a single attribute.
   It is called by both the function to delete a list and attribute set/put 
@@ -133,7 +133,7 @@ int MPIR_Call_attr_delete( int handle, MPID_Attribute *attr_p )
 #undef FUNCNAME
 #define FUNCNAME MPIR_Call_attr_copy
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Call_attr_copy( int handle, MPID_Attribute *attr_p, void** value_copy, int* flag)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -173,7 +173,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Attr_dup_list
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /* Routine to duplicate an attribute list */
 int MPIR_Attr_dup_list( int handle, MPID_Attribute *old_attrs, 
 			MPID_Attribute **new_attr )
@@ -239,7 +239,7 @@ int MPIR_Attr_dup_list( int handle, MPID_Attribute *old_attrs,
 #undef FUNCNAME
 #define FUNCNAME MPIR_Attr_delete_list
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /* Routine to delete an attribute list */
 int MPIR_Attr_delete_list( int handle, MPID_Attribute **attr )
 {
@@ -256,7 +256,7 @@ int MPIR_Attr_delete_list( int handle, MPID_Attribute **attr )
 	/* Check the sentinals first */
 	/* --BEGIN ERROR HANDLING-- */
 	if (p->pre_sentinal != 0 || p->post_sentinal != 0) {
-	    MPIU_ERR_SET(mpi_errno,MPI_ERR_OTHER,"**attrsentinal");
+	    MPIR_ERR_SET(mpi_errno,MPI_ERR_OTHER,"**attrsentinal");
 	    /* We could keep trying to free the attributes, but for now
 	       we'll just bag it */
 	    return mpi_errno;
@@ -325,11 +325,11 @@ MPIR_Attr_copy_c_proxy(
     }
 
     /* user functions might call other MPI functions, so we need to
-     * release the lock here. This is safe to do as ALLFUNC is not at
+     * release the lock here. This is safe to do as GLOBAL is not at
      * all recursive in our implementation. */
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     ret = user_function(handle, keyval, extra_state, attrib_val, attrib_copy, flag);
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
 
     return ret;
 }
@@ -355,11 +355,11 @@ MPIR_Attr_delete_c_proxy(
         attrib_val = attrib;
 
     /* user functions might call other MPI functions, so we need to
-     * release the lock here. This is safe to do as ALLFUNC is not at
+     * release the lock here. This is safe to do as GLOBAL is not at
      * all recursive in our implementation. */
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     ret = user_function(handle, keyval, attrib_val, extra_state);
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
 
     return ret;
 }
diff --git a/src/mpi/attr/comm_create_keyval.c b/src/mpi/attr/comm_create_keyval.c
index e2f5f28..379d572 100644
--- a/src/mpi/attr/comm_create_keyval.c
+++ b/src/mpi/attr/comm_create_keyval.c
@@ -40,7 +40,7 @@ int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function *comm_copy_attr_fn,
 #undef FUNCNAME
 #define FUNCNAME MPIR_Comm_create_keyval_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Comm_create_keyval_impl(MPI_Comm_copy_attr_function *comm_copy_attr_fn,
                                  MPI_Comm_delete_attr_function *comm_delete_attr_fn,
                                  int *comm_keyval, void *extra_state)
@@ -49,7 +49,7 @@ int MPIR_Comm_create_keyval_impl(MPI_Comm_copy_attr_function *comm_copy_attr_fn,
     MPID_Keyval *keyval_ptr;
         
     keyval_ptr = (MPID_Keyval *)MPIU_Handle_obj_alloc( &MPID_Keyval_mem );
-    MPIU_ERR_CHKANDJUMP(!keyval_ptr, mpi_errno, MPI_ERR_OTHER,"**nomem");
+    MPIR_ERR_CHKANDJUMP(!keyval_ptr, mpi_errno, MPI_ERR_OTHER,"**nomem");
 
     /* Initialize the attribute dup function */
     if (!MPIR_Process.attr_dup) {
@@ -84,7 +84,7 @@ int MPIR_Comm_create_keyval_impl(MPI_Comm_copy_attr_function *comm_copy_attr_fn,
 #undef FUNCNAME
 #define FUNCNAME MPI_Comm_create_keyval
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
    MPI_Comm_create_keyval - Create a new attribute key 
 
@@ -130,7 +130,7 @@ int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function *comm_copy_attr_fn,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_CREATE_KEYVAL);
 
     /* Validate parameters and objects (post conversion) */
@@ -153,7 +153,7 @@ int MPI_Comm_create_keyval(MPI_Comm_copy_attr_function *comm_copy_attr_fn,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_CREATE_KEYVAL);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/comm_delete_attr.c b/src/mpi/attr/comm_delete_attr.c
index c184d43..4a2a2f3 100644
--- a/src/mpi/attr/comm_delete_attr.c
+++ b/src/mpi/attr/comm_delete_attr.c
@@ -29,7 +29,7 @@ int MPI_Comm_delete_attr(MPI_Comm comm, int comm_keyval) __attribute__((weak,ali
 #undef FUNCNAME
 #define FUNCNAME MPIR_Comm_delete_attr_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Comm_delete_attr_impl(MPID_Comm *comm_ptr, MPID_Keyval *keyval_ptr)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -85,7 +85,7 @@ int MPIR_Comm_delete_attr_impl(MPID_Comm *comm_ptr, MPID_Keyval *keyval_ptr)
 #undef FUNCNAME
 #define FUNCNAME MPI_Comm_delete_attr
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
    MPI_Comm_delete_attr - Deletes an attribute value associated with a key on 
    a  communicator
@@ -114,7 +114,7 @@ int MPI_Comm_delete_attr(MPI_Comm comm, int comm_keyval)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_DELETE_ATTR);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -159,7 +159,7 @@ int MPI_Comm_delete_attr(MPI_Comm comm, int comm_keyval)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_DELETE_ATTR);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/comm_free_keyval.c b/src/mpi/attr/comm_free_keyval.c
index 6536f76..69e5973 100644
--- a/src/mpi/attr/comm_free_keyval.c
+++ b/src/mpi/attr/comm_free_keyval.c
@@ -29,7 +29,7 @@ int MPI_Comm_free_keyval(int *comm_keyval) __attribute__((weak,alias("PMPI_Comm_
 #undef FUNCNAME
 #define FUNCNAME MPIR_Comm_free_keyval_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 void MPIR_Comm_free_keyval_impl(int keyval)
 {
     int in_use;
@@ -52,7 +52,7 @@ void MPIR_Comm_free_keyval_impl(int keyval)
 #undef FUNCNAME
 #define FUNCNAME MPI_Comm_free_keyval
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
    MPI_Comm_free_keyval - Frees an attribute key for communicators
 
@@ -78,7 +78,7 @@ int MPI_Comm_free_keyval(int *comm_keyval)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_FREE_KEYVAL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -122,7 +122,7 @@ int MPI_Comm_free_keyval(int *comm_keyval)
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_FREE_KEYVAL);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/attr/comm_get_attr.c b/src/mpi/attr/comm_get_attr.c
index 5ddeb01..a3f22a2 100644
--- a/src/mpi/attr/comm_get_attr.c
+++ b/src/mpi/attr/comm_get_attr.c
@@ -64,7 +64,7 @@ int MPIR_CommGetAttr( MPI_Comm comm, int comm_keyval, void *attribute_val,
 	       case.  Note that this code assumes sizeof(MPIU_Pint) is 
 	       a power of 2. */
 	    if ((MPIU_Pint)attribute_val & (sizeof(MPIU_Pint)-1)) {
-		MPIU_ERR_SETANDSTMT(mpi_errno,MPI_ERR_ARG,goto fn_fail,"**attrnotptr");
+		MPIR_ERR_SETANDSTMT(mpi_errno,MPI_ERR_ARG,goto fn_fail,"**attrnotptr");
 	    }
 #           endif
         }
@@ -300,9 +300,9 @@ int MPIR_CommGetAttr_fort(MPI_Comm comm, int comm_keyval, void *attribute_val,
 {
     int mpi_errno;
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     mpi_errno = MPIR_CommGetAttr(comm, comm_keyval, attribute_val, flag, outAttrType);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
 
     return mpi_errno;
 }
@@ -313,7 +313,7 @@ int MPIR_CommGetAttr_fort(MPI_Comm comm, int comm_keyval, void *attribute_val,
 #undef FUNCNAME
 #define FUNCNAME MPI_Comm_get_attr
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 
 /* FIXME: Attributes must be visable from all languages */
 /*@
@@ -355,7 +355,7 @@ int MPI_Comm_get_attr(MPI_Comm comm, int comm_keyval, void *attribute_val,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_GET_ATTR);
 
     /* Instead, ask for a desired type. */
@@ -366,7 +366,7 @@ int MPI_Comm_get_attr(MPI_Comm comm, int comm_keyval, void *attribute_val,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_GET_ATTR);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/comm_set_attr.c b/src/mpi/attr/comm_set_attr.c
index 8da5935..558a883 100644
--- a/src/mpi/attr/comm_set_attr.c
+++ b/src/mpi/attr/comm_set_attr.c
@@ -29,7 +29,7 @@ int MPI_Comm_set_attr(MPI_Comm comm, int comm_keyval, void *attribute_val) __att
 #undef FUNCNAME
 #define FUNCNAME MPIR_Comm_set_attr_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Comm_set_attr_impl(MPID_Comm *comm_ptr, int comm_keyval, void *attribute_val, 
                             MPIR_AttrType attrType)
 {
@@ -37,7 +37,7 @@ int MPIR_Comm_set_attr_impl(MPID_Comm *comm_ptr, int comm_keyval, void *attribut
     MPID_Keyval *keyval_ptr = NULL;
     MPID_Attribute *p;
 
-    MPIU_ERR_CHKANDJUMP(comm_keyval == MPI_KEYVAL_INVALID, mpi_errno, MPI_ERR_KEYVAL, "**keyvalinvalid");
+    MPIR_ERR_CHKANDJUMP(comm_keyval == MPI_KEYVAL_INVALID, mpi_errno, MPI_ERR_KEYVAL, "**keyvalinvalid");
 
     /* CHANGE FOR MPI 2.2:  Look for attribute.  They are ordered by when they
        were added, with the most recent first. This uses 
@@ -75,7 +75,7 @@ int MPIR_Comm_set_attr_impl(MPID_Comm *comm_ptr, int comm_keyval, void *attribut
     /* CHANGE FOR MPI 2.2: If not found, add at the beginning */
     if (!p) {
 	MPID_Attribute *new_p = MPID_Attr_alloc();
-	MPIU_ERR_CHKANDJUMP(!new_p,mpi_errno,MPI_ERR_OTHER,"**nomem");
+	MPIR_ERR_CHKANDJUMP(!new_p,mpi_errno,MPI_ERR_OTHER,"**nomem");
 	/* Did not find in list.  Add at end */
 	new_p->keyval	     = keyval_ptr;
 	new_p->attrType      = attrType;
@@ -105,7 +105,7 @@ int MPIR_Comm_set_attr_impl(MPID_Comm *comm_ptr, int comm_keyval, void *attribut
 #undef FUNCNAME
 #define FUNCNAME MPIR_CommSetAttr
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_CommSetAttr( MPI_Comm comm, int comm_keyval, void *attribute_val, 
 		      MPIR_AttrType attrType )
 {
@@ -115,7 +115,7 @@ int MPIR_CommSetAttr( MPI_Comm comm, int comm_keyval, void *attribute_val,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_COMM_SET_ATTR);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -161,7 +161,7 @@ int MPIR_CommSetAttr( MPI_Comm comm, int comm_keyval, void *attribute_val,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_COMM_SET_ATTR);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
@@ -182,7 +182,7 @@ int MPIR_CommSetAttr( MPI_Comm comm, int comm_keyval, void *attribute_val,
 #undef FUNCNAME
 #define FUNCNAME MPI_Comm_set_attr
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
    MPI_Comm_set_attr - Stores attribute value associated with a key
 
@@ -222,7 +222,7 @@ int MPI_Comm_set_attr(MPI_Comm comm, int comm_keyval, void *attribute_val)
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_COMM_SET_ATTR);
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_COMM_SET_ATTR);
 
      /* Validate parameters, especially handles needing to be converted */
@@ -267,7 +267,7 @@ int MPI_Comm_set_attr(MPI_Comm comm, int comm_keyval, void *attribute_val)
 
  fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_COMM_SET_ATTR);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/keyval_create.c b/src/mpi/attr/keyval_create.c
index 27a194d..8014942 100644
--- a/src/mpi/attr/keyval_create.c
+++ b/src/mpi/attr/keyval_create.c
@@ -76,7 +76,7 @@ int MPI_Keyval_create(MPI_Copy_function *copy_fn,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_KEYVAL_CREATE);
 
     /* Validate parameters and objects (post conversion) */
@@ -99,7 +99,7 @@ int MPI_Keyval_create(MPI_Copy_function *copy_fn,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_KEYVAL_CREATE);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/keyval_free.c b/src/mpi/attr/keyval_free.c
index e107af8..560627c 100644
--- a/src/mpi/attr/keyval_free.c
+++ b/src/mpi/attr/keyval_free.c
@@ -63,7 +63,7 @@ int MPI_Keyval_free(int *keyval)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_KEYVAL_FREE);
 #   ifdef HAVE_ERROR_CHECKING
     {
@@ -101,7 +101,7 @@ int MPI_Keyval_free(int *keyval)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_KEYVAL_FREE);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/type_create_keyval.c b/src/mpi/attr/type_create_keyval.c
index 1084696..76df18b 100644
--- a/src/mpi/attr/type_create_keyval.c
+++ b/src/mpi/attr/type_create_keyval.c
@@ -81,7 +81,7 @@ int MPI_Type_create_keyval(MPI_Type_copy_attr_function *type_copy_attr_fn,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_CREATE_KEYVAL);
     
     /* Validate parameters and objects (post conversion) */
@@ -98,7 +98,7 @@ int MPI_Type_create_keyval(MPI_Type_copy_attr_function *type_copy_attr_fn,
     /* ... body of routine ...  */
     
     keyval_ptr = (MPID_Keyval *)MPIU_Handle_obj_alloc( &MPID_Keyval_mem );
-    MPIU_ERR_CHKANDJUMP(!keyval_ptr,mpi_errno,MPI_ERR_OTHER,"**nomem");
+    MPIR_ERR_CHKANDJUMP(!keyval_ptr,mpi_errno,MPI_ERR_OTHER,"**nomem");
 
     /* Initialize the attribute dup function */
     if (!MPIR_Process.attr_dup) {
@@ -128,7 +128,7 @@ int MPI_Type_create_keyval(MPI_Type_copy_attr_function *type_copy_attr_fn,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_CREATE_KEYVAL);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/type_delete_attr.c b/src/mpi/attr/type_delete_attr.c
index 0f77e00..639a586 100644
--- a/src/mpi/attr/type_delete_attr.c
+++ b/src/mpi/attr/type_delete_attr.c
@@ -61,7 +61,7 @@ int MPI_Type_delete_attr(MPI_Datatype datatype, int type_keyval)
     
     /* The thread lock prevents a valid attr delete on the same datatype
        but in a different thread from causing problems */
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_DELETE_ATTR);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -145,7 +145,7 @@ int MPI_Type_delete_attr(MPI_Datatype datatype, int type_keyval)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_DELETE_ATTR);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/type_free_keyval.c b/src/mpi/attr/type_free_keyval.c
index c52dc3b..e29ae1b 100644
--- a/src/mpi/attr/type_free_keyval.c
+++ b/src/mpi/attr/type_free_keyval.c
@@ -58,7 +58,7 @@ int MPI_Type_free_keyval(int *type_keyval)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_TYPE_FREE_KEYVAL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -106,7 +106,7 @@ int MPI_Type_free_keyval(int *type_keyval)
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_TYPE_FREE_KEYVAL);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/attr/type_get_attr.c b/src/mpi/attr/type_get_attr.c
index ac62d75..e3958ab 100644
--- a/src/mpi/attr/type_get_attr.c
+++ b/src/mpi/attr/type_get_attr.c
@@ -42,7 +42,7 @@ int MPIR_TypeGetAttr( MPI_Datatype datatype, int type_keyval, void *attribute_va
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_TYPE_GET_ATTR);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -59,7 +59,7 @@ int MPIR_TypeGetAttr( MPI_Datatype datatype, int type_keyval, void *attribute_va
 	       case.  Note that this code assumes sizeof(MPIU_Pint) is 
 	       a power of 2. */
 	    if ((MPIU_Pint)attribute_val & (sizeof(MPIU_Pint)-1)) {
-		MPIU_ERR_SETANDSTMT(mpi_errno,MPI_ERR_ARG,goto fn_fail,"**attrnotptr");
+		MPIR_ERR_SETANDSTMT(mpi_errno,MPI_ERR_ARG,goto fn_fail,"**attrnotptr");
 	    }
 #           endif
         }
@@ -130,7 +130,7 @@ int MPIR_TypeGetAttr( MPI_Datatype datatype, int type_keyval, void *attribute_va
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_TYPE_GET_ATTR);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
@@ -153,7 +153,7 @@ int MPIR_TypeGetAttr( MPI_Datatype datatype, int type_keyval, void *attribute_va
 #undef FUNCNAME
 #define FUNCNAME MPI_Type_get_attr
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 
 /*@
    MPI_Type_get_attr - Retrieves attribute value by key
diff --git a/src/mpi/attr/type_set_attr.c b/src/mpi/attr/type_set_attr.c
index 1239d5a..dfd118f 100644
--- a/src/mpi/attr/type_set_attr.c
+++ b/src/mpi/attr/type_set_attr.c
@@ -42,7 +42,7 @@ int MPIR_TypeSetAttr(MPI_Datatype datatype, int type_keyval, void *attribute_val
     
     /* The thread lock prevents a valid attr delete on the same datatype
        but in a different thread from causing problems */
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_TYPE_SET_ATTR);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -101,7 +101,7 @@ int MPIR_TypeSetAttr(MPI_Datatype datatype, int type_keyval, void *attribute_val
 	}
 	else if (p->keyval->handle > keyval_ptr->handle) {
 	    MPID_Attribute *new_p = MPID_Attr_alloc();
-	    MPIU_ERR_CHKANDJUMP1(!new_p,mpi_errno,MPI_ERR_OTHER,
+	    MPIR_ERR_CHKANDJUMP1(!new_p,mpi_errno,MPI_ERR_OTHER,
 				 "**nomem","**nomem %s", "MPID_Attribute" );
 	    new_p->keyval	 = keyval_ptr;
 	    new_p->attrType      = attrType;
@@ -119,7 +119,7 @@ int MPIR_TypeSetAttr(MPI_Datatype datatype, int type_keyval, void *attribute_val
     if (!p)
     {
 	MPID_Attribute *new_p = MPID_Attr_alloc();
-	MPIU_ERR_CHKANDJUMP1(!new_p,mpi_errno,MPI_ERR_OTHER,
+	MPIR_ERR_CHKANDJUMP1(!new_p,mpi_errno,MPI_ERR_OTHER,
 			     "**nomem","**nomem %s", "MPID_Attribute" );
 	/* Did not find in list.  Add at end */
 	new_p->keyval	     = keyval_ptr;
@@ -141,7 +141,7 @@ int MPIR_TypeSetAttr(MPI_Datatype datatype, int type_keyval, void *attribute_val
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_TYPE_SET_ATTR);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/win_create_keyval.c b/src/mpi/attr/win_create_keyval.c
index b632701..a533189 100644
--- a/src/mpi/attr/win_create_keyval.c
+++ b/src/mpi/attr/win_create_keyval.c
@@ -81,7 +81,7 @@ int MPI_Win_create_keyval(MPI_Win_copy_attr_function *win_copy_attr_fn,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_CREATE_KEYVAL);
 
     /* Validate parameters and objects (post conversion) */
@@ -98,7 +98,7 @@ int MPI_Win_create_keyval(MPI_Win_copy_attr_function *win_copy_attr_fn,
     /* ... body of routine ...  */
     
     keyval_ptr = (MPID_Keyval *)MPIU_Handle_obj_alloc( &MPID_Keyval_mem );
-    MPIU_ERR_CHKANDJUMP1(!keyval_ptr,mpi_errno,MPI_ERR_OTHER,"**nomem",
+    MPIR_ERR_CHKANDJUMP1(!keyval_ptr,mpi_errno,MPI_ERR_OTHER,"**nomem",
 			 "**nomem %s", "MPID_Keyval" );
     /* Initialize the attribute dup function */
     if (!MPIR_Process.attr_dup) {
@@ -124,7 +124,7 @@ int MPI_Win_create_keyval(MPI_Win_copy_attr_function *win_copy_attr_fn,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_CREATE_KEYVAL);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/win_delete_attr.c b/src/mpi/attr/win_delete_attr.c
index 199aa3f..710da70 100644
--- a/src/mpi/attr/win_delete_attr.c
+++ b/src/mpi/attr/win_delete_attr.c
@@ -62,7 +62,7 @@ int MPI_Win_delete_attr(MPI_Win win, int win_keyval)
     
     /* The thread lock prevents a valid attr delete on the same window
        but in a different thread from causing problems */
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_DELETE_ATTR);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -144,7 +144,7 @@ int MPI_Win_delete_attr(MPI_Win win, int win_keyval)
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_DELETE_ATTR);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/attr/win_free_keyval.c b/src/mpi/attr/win_free_keyval.c
index 5c58caa..4d76a1a 100644
--- a/src/mpi/attr/win_free_keyval.c
+++ b/src/mpi/attr/win_free_keyval.c
@@ -59,7 +59,7 @@ int MPI_Win_free_keyval(int *win_keyval)
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_WIN_FREE_KEYVAL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -107,7 +107,7 @@ int MPI_Win_free_keyval(int *win_keyval)
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_WIN_FREE_KEYVAL);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
diff --git a/src/mpi/attr/win_get_attr.c b/src/mpi/attr/win_get_attr.c
index c6cc3a2..d306f7b 100644
--- a/src/mpi/attr/win_get_attr.c
+++ b/src/mpi/attr/win_get_attr.c
@@ -28,7 +28,7 @@ int MPI_Win_get_attr(MPI_Win win, int win_keyval, void *attribute_val, int *flag
 #undef FUNCNAME
 #define FUNCNAME MPIR_WinGetAttr
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_WinGetAttr( MPI_Win win, int win_keyval, void *attribute_val, 
 		     int *flag, MPIR_AttrType outAttrType )
 {
@@ -38,7 +38,7 @@ int MPIR_WinGetAttr( MPI_Win win, int win_keyval, void *attribute_val,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_WIN_GET_ATTR);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -55,7 +55,7 @@ int MPIR_WinGetAttr( MPI_Win win, int win_keyval, void *attribute_val,
 	       case.  Note that this code assumes sizeof(MPIU_Pint) is
 	       a power of 2. */
 	    if ((MPIU_Pint)attribute_val & (sizeof(MPIU_Pint)-1)) {
-		MPIU_ERR_SETANDSTMT(mpi_errno,MPI_ERR_ARG,goto fn_fail,"**attrnotptr");
+		MPIR_ERR_SETANDSTMT(mpi_errno,MPI_ERR_ARG,goto fn_fail,"**attrnotptr");
 	    }
 #           endif
         }
@@ -198,7 +198,7 @@ int MPIR_WinGetAttr( MPI_Win win, int win_keyval, void *attribute_val,
   fn_exit:
 #endif
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_WIN_GET_ATTR);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
     /* --BEGIN ERROR HANDLING-- */
@@ -221,7 +221,7 @@ int MPIR_WinGetAttr( MPI_Win win, int win_keyval, void *attribute_val,
 #undef FUNCNAME
 #define FUNCNAME MPI_Win_get_attr
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
    MPI_Win_get_attr - Get attribute cached on an MPI window object
 
diff --git a/src/mpi/attr/win_set_attr.c b/src/mpi/attr/win_set_attr.c
index 6135db4..2d66409 100644
--- a/src/mpi/attr/win_set_attr.c
+++ b/src/mpi/attr/win_set_attr.c
@@ -42,7 +42,7 @@ int MPIR_WinSetAttr( MPI_Win win, int win_keyval, void *attribute_val,
     
     /* The thread lock prevents a valid attr delete on the same window
        but in a different thread from causing problems */
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPIR_WIN_SET_ATTR);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -107,7 +107,7 @@ int MPIR_WinSetAttr( MPI_Win win, int win_keyval, void *attribute_val,
 	}
 	else if (p->keyval->handle > keyval_ptr->handle) {
 	    MPID_Attribute *new_p = MPID_Attr_alloc();
-	    MPIU_ERR_CHKANDJUMP1(!new_p,mpi_errno,MPI_ERR_OTHER,
+	    MPIR_ERR_CHKANDJUMP1(!new_p,mpi_errno,MPI_ERR_OTHER,
 				 "**nomem", "**nomem %s", "MPID_Attribute" );
 	    new_p->keyval	 = keyval_ptr;
 	    new_p->attrType      = attrType;
@@ -125,7 +125,7 @@ int MPIR_WinSetAttr( MPI_Win win, int win_keyval, void *attribute_val,
     if (!p)
     {
 	MPID_Attribute *new_p = MPID_Attr_alloc();
-	MPIU_ERR_CHKANDJUMP1(!new_p,mpi_errno,MPI_ERR_OTHER,
+	MPIR_ERR_CHKANDJUMP1(!new_p,mpi_errno,MPI_ERR_OTHER,
 			     "**nomem", "**nomem %s", "MPID_Attribute" );
 	/* Did not find in list.  Add at end */
 	new_p->attrType      = attrType;
@@ -147,7 +147,7 @@ int MPIR_WinSetAttr( MPI_Win win, int win_keyval, void *attribute_val,
 
   fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPIR_WIN_SET_ATTR);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,); 
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex); 
     return mpi_errno;
 
   fn_fail:
@@ -168,7 +168,7 @@ int MPIR_WinSetAttr( MPI_Win win, int win_keyval, void *attribute_val,
 #undef FUNCNAME
 #define FUNCNAME MPI_Win_set_attr
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 
 /*@
    MPI_Win_set_attr - Stores attribute value associated with a key
diff --git a/src/mpi/coll/allgather.c b/src/mpi/coll/allgather.c
index 877ccfa..bcd1c69 100644
--- a/src/mpi/coll/allgather.c
+++ b/src/mpi/coll/allgather.c
@@ -108,7 +108,7 @@ int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, voi
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allgather_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Allgather_intra ( 
     const void *sendbuf,
     int sendcount,
@@ -174,7 +174,7 @@ int MPIR_Allgather_intra (
                                              rank*recvcount*recvtype_extent), 
                                             recvcount, recvtype);
 		if (mpi_errno) { 
-		    MPIU_ERR_POP(mpi_errno);
+		    MPIR_ERR_POP(mpi_errno);
 		}
             }
             
@@ -211,8 +211,8 @@ int MPIR_Allgather_intra (
 		    if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                         last_recv_cnt = 0;
 		    } else
                         MPIR_Get_count_impl(&status, recvtype, &last_recv_cnt);
@@ -276,8 +276,8 @@ int MPIR_Allgather_intra (
                             if (mpi_errno) {
                                 /* for communication errors, just record the error but continue */
                                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                             }
                         }
                         /* recv only if this proc. doesn't have data and sender
@@ -295,8 +295,8 @@ int MPIR_Allgather_intra (
                             if (mpi_errno) {
                                 /* for communication errors, just record the error but continue */
                                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                                 last_recv_cnt = 0;
                             } else
                                 MPIR_Get_count_impl(&status, recvtype, &last_recv_cnt);
@@ -338,13 +338,13 @@ int MPIR_Allgather_intra (
             if (sendbuf != MPI_IN_PLACE) {
                 mpi_errno = MPIR_Pack_impl(sendbuf, sendcount, sendtype, tmp_buf, tmp_buf_size,
                                            &position);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             else {
                 /* if in_place specified, local data is found in recvbuf */
                 mpi_errno = MPIR_Pack_impl(((char *)recvbuf + recvtype_extent*rank), recvcount,
                                            recvtype, tmp_buf, tmp_buf_size, &position);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             
             curr_cnt = nbytes;
@@ -379,8 +379,8 @@ int MPIR_Allgather_intra (
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                         last_recv_cnt = 0;
                     } else
                         MPIR_Get_count_impl(&status, MPI_BYTE, &last_recv_cnt);
@@ -434,8 +434,8 @@ int MPIR_Allgather_intra (
                             if (mpi_errno) {
                                 /* for communication errors, just record the error but continue */
                                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                             }
                             /* last_recv_cnt was set in the previous
                                receive. that's the amount of data to be
@@ -456,8 +456,8 @@ int MPIR_Allgather_intra (
                             if (mpi_errno) {
                                 /* for communication errors, just record the error but continue */
                                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                                 last_recv_cnt = 0;
                             } else
                                 MPIR_Get_count_impl(&status, MPI_BYTE, &last_recv_cnt);
@@ -474,7 +474,7 @@ int MPIR_Allgather_intra (
             position = 0;
             mpi_errno = MPIR_Unpack_impl(tmp_buf, tmp_buf_size, &position, recvbuf,
                                          recvcount*comm_size, recvtype);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
 #endif /* MPID_HAS_HETERO */
     }
@@ -501,7 +501,7 @@ int MPIR_Allgather_intra (
             mpi_errno = MPIR_Localcopy (sendbuf, sendcount, sendtype,
                                         tmp_buf, recvcount, recvtype);
 	    if (mpi_errno) { 
-		MPIU_ERR_POP(mpi_errno);
+		MPIR_ERR_POP(mpi_errno);
 	    }
         }
         else {
@@ -510,7 +510,7 @@ int MPIR_Allgather_intra (
                                         recvcount, recvtype, tmp_buf, 
                                         recvcount, recvtype);
 	    if (mpi_errno) { 
-		MPIU_ERR_POP(mpi_errno);
+		MPIR_ERR_POP(mpi_errno);
 	    }
         }
         
@@ -531,8 +531,8 @@ int MPIR_Allgather_intra (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
             curr_cnt *= 2;
             pof2 *= 2;
@@ -554,8 +554,8 @@ int MPIR_Allgather_intra (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
 
@@ -566,7 +566,7 @@ int MPIR_Allgather_intra (
                   recvtype, (char *) recvbuf + rank*recvcount*recvtype_extent, 
                                        (comm_size-rank)*recvcount, recvtype);
 	if (mpi_errno) { 
-	    MPIU_ERR_POP(mpi_errno);
+	    MPIR_ERR_POP(mpi_errno);
 	}
 
         if (rank) {
@@ -575,7 +575,7 @@ int MPIR_Allgather_intra (
                                        rank*recvcount, recvtype, recvbuf,
                                        rank*recvcount, recvtype);
 	    if (mpi_errno) { 
-		MPIU_ERR_POP(mpi_errno);
+		MPIR_ERR_POP(mpi_errno);
 	    }
         }
     }
@@ -590,7 +590,7 @@ int MPIR_Allgather_intra (
                                         rank*recvcount*recvtype_extent),  
                                        recvcount, recvtype);
 	    if (mpi_errno) { 
-		MPIU_ERR_POP(mpi_errno);
+		MPIR_ERR_POP(mpi_errno);
 	    }
         }
         
@@ -616,8 +616,8 @@ int MPIR_Allgather_intra (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
             j	    = jnext;
             jnext = (comm_size + jnext - 1) % comm_size;
@@ -631,7 +631,7 @@ int MPIR_Allgather_intra (
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
 
     return mpi_errno;
 
@@ -643,7 +643,7 @@ int MPIR_Allgather_intra (
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allgather_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 
 /* not declared static because a machine-specific function may call this one 
    in some cases */
@@ -701,8 +701,8 @@ int MPIR_Allgather_inter (
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
 
@@ -717,8 +717,8 @@ int MPIR_Allgather_inter (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
 
@@ -730,8 +730,8 @@ int MPIR_Allgather_inter (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
     }
@@ -744,8 +744,8 @@ int MPIR_Allgather_inter (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
 
@@ -757,8 +757,8 @@ int MPIR_Allgather_inter (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
     }
@@ -768,7 +768,7 @@ int MPIR_Allgather_inter (
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
 
     return mpi_errno;
 
@@ -784,7 +784,7 @@ int MPIR_Allgather_inter (
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allgather
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                    void *recvbuf, int recvcount, MPI_Datatype recvtype,
                    MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
@@ -796,13 +796,13 @@ int MPIR_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
         mpi_errno = MPIR_Allgather_intra(sendbuf, sendcount, sendtype,
                                          recvbuf, recvcount, recvtype,
                                          comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     } else {
         /* intercommunicator */
         mpi_errno = MPIR_Allgather_inter(sendbuf, sendcount, sendtype,
                                          recvbuf, recvcount, recvtype,
                                          comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
 fn_exit:
@@ -818,7 +818,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allgather_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Allgather_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                         void *recvbuf, int recvcount, MPI_Datatype recvtype,
                         MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
@@ -831,13 +831,13 @@ int MPIR_Allgather_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtyp
 	mpi_errno = comm_ptr->coll_fns->Allgather(sendbuf, sendcount, sendtype,
                                                   recvbuf, recvcount, recvtype,
                                                   comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	/* --END USEREXTENSION-- */
     } else {
         mpi_errno = MPIR_Allgather(sendbuf, sendcount, sendtype,
                                    recvbuf, recvcount, recvtype,
                                    comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
 fn_exit:
@@ -852,7 +852,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPI_Allgather
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Allgather - Gathers data from all tasks and distribute the combined
     data to all tasks
@@ -907,7 +907,7 @@ int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_ALLGATHER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -989,7 +989,7 @@ int MPI_Allgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_ALLGATHER);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/allgatherv.c b/src/mpi/coll/allgatherv.c
index 3cefcbe..bc976b8 100644
--- a/src/mpi/coll/allgatherv.c
+++ b/src/mpi/coll/allgatherv.c
@@ -88,7 +88,7 @@ int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, vo
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allgatherv_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Allgatherv_intra ( 
     const void *sendbuf,
     int sendcount,
@@ -165,7 +165,7 @@ int MPIR_Allgatherv_intra (
                                            ((char *)tmp_buf + position*
                                             recvtype_extent), 
                                            recvcounts[rank], recvtype);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	    }
             else
 	    {
@@ -176,7 +176,7 @@ int MPIR_Allgatherv_intra (
                                            ((char *)tmp_buf + position*
                                             recvtype_extent), 
                                            recvcounts[rank], recvtype);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	    }
 
             curr_cnt = recvcounts[rank];
@@ -216,8 +216,8 @@ int MPIR_Allgatherv_intra (
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                         last_recv_cnt = 0;
                     } else
                         /* for convenience, recv is posted for a bigger amount
@@ -284,8 +284,8 @@ int MPIR_Allgatherv_intra (
                             if (mpi_errno) {
                                 /* for communication errors, just record the error but continue */
                                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                             }
                             /* last_recv_cnt was set in the previous
                                receive. that's the amount of data to be
@@ -308,8 +308,8 @@ int MPIR_Allgatherv_intra (
                             if (mpi_errno) {
                                 /* for communication errors, just record the error but continue */
                                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                                 last_recv_cnt = 0;
                             } else
                                 /* for convenience, recv is posted for a
@@ -337,7 +337,7 @@ int MPIR_Allgatherv_intra (
                                                recvcounts[j], recvtype,
                                                ((char *)recvbuf + displs[j]*recvtype_extent),
                                                recvcounts[j], recvtype);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 }
                 position += recvcounts[j];
             }
@@ -358,7 +358,7 @@ int MPIR_Allgatherv_intra (
             position = 0;
             mpi_errno = MPIR_Pack_impl(recvbuf, 1, recvtype, tmp_buf, tmp_buf_size,
                                        &position);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             nbytes = position;
             
             /* pack local data into right location in tmp_buf */
@@ -369,14 +369,14 @@ int MPIR_Allgatherv_intra (
             if (sendbuf != MPI_IN_PLACE) {
                 mpi_errno = MPIR_Pack_impl(sendbuf, sendcount, sendtype, tmp_buf,
                                            tmp_buf_size, &position);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             else {
                 /* if in_place specified, local data is found in recvbuf */ 
                 mpi_errno = MPIR_Pack_impl(((char *)recvbuf + displs[rank]*recvtype_extent),
                                            recvcounts[rank], recvtype, tmp_buf,
                                            tmp_buf_size, &position);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             
             curr_cnt = recvcounts[rank]*nbytes;
@@ -417,8 +417,8 @@ int MPIR_Allgatherv_intra (
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                         last_recv_cnt = 0;
                     } else
                         /* for convenience, recv is posted for a bigger amount
@@ -477,8 +477,8 @@ int MPIR_Allgatherv_intra (
                             if (mpi_errno) {
                                 /* for communication errors, just record the error but continue */
                                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                             }
                             /* last_recv_cnt was set in the previous
                                receive. that's the amount of data to be
@@ -497,8 +497,8 @@ int MPIR_Allgatherv_intra (
                             if (mpi_errno) {
                                 /* for communication errors, just record the error but continue */
                                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                                 last_recv_cnt = 0;
                             } else
                                 /* for convenience, recv is posted for a bigger amount
@@ -522,7 +522,7 @@ int MPIR_Allgatherv_intra (
                     mpi_errno = MPIR_Unpack_impl(tmp_buf, tmp_buf_size, &position,
                                                  ((char *)recvbuf + displs[j]*recvtype_extent),
                                                  recvcounts[j], recvtype);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 }
             }
         }
@@ -553,14 +553,14 @@ int MPIR_Allgatherv_intra (
         if (sendbuf != MPI_IN_PLACE) {
             mpi_errno = MPIR_Localcopy (sendbuf, sendcount, sendtype,
                                         tmp_buf, recvcounts[rank], recvtype);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         else {
             mpi_errno = MPIR_Localcopy(((char *)recvbuf +
                                         displs[rank]*recvtype_extent), 
                                        recvcounts[rank], recvtype,
                                        tmp_buf, recvcounts[rank], recvtype);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         
         /* do the first \floor(\lg p) steps */
@@ -579,8 +579,8 @@ int MPIR_Allgatherv_intra (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 recv_cnt = 0;
             } else
                 MPIR_Get_count_impl(&status, recvtype, &recv_cnt);
@@ -609,8 +609,8 @@ int MPIR_Allgatherv_intra (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
 
@@ -624,7 +624,7 @@ int MPIR_Allgatherv_intra (
                                        recvcounts[j], recvtype, 
                                   (char *)recvbuf + displs[j]*recvtype_extent, 
                                        recvcounts[j], recvtype);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             send_cnt += recvcounts[j];
         }
 
@@ -633,7 +633,7 @@ int MPIR_Allgatherv_intra (
                                        recvcounts[i], recvtype, 
                                   (char *)recvbuf + displs[i]*recvtype_extent, 
                                        recvcounts[i], recvtype);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             send_cnt += recvcounts[i];
         }
     }
@@ -651,7 +651,7 @@ int MPIR_Allgatherv_intra (
             mpi_errno = MPIR_Localcopy(sendbuf, sendcount, sendtype, 
 				       ((char *)recvbuf + displs[rank]*recvtype_extent),
                                        recvcounts[rank], recvtype);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
 
         left  = (comm_size + rank - 1) % comm_size;
@@ -697,8 +697,8 @@ int MPIR_Allgatherv_intra (
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
 		torecv -= recvnow;
 	    }
@@ -707,8 +707,8 @@ int MPIR_Allgatherv_intra (
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
 		tosend -= sendnow;
 	    }
@@ -719,8 +719,8 @@ int MPIR_Allgatherv_intra (
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
 		tosend -= sendnow;
 		torecv -= recvnow;
@@ -746,7 +746,7 @@ int MPIR_Allgatherv_intra (
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
 
     return mpi_errno;
  fn_fail:
@@ -759,7 +759,7 @@ int MPIR_Allgatherv_intra (
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allgatherv_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Allgatherv_inter ( 
     const void *sendbuf,
     int sendcount,
@@ -798,8 +798,8 @@ int MPIR_Allgatherv_inter (
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
         /* gatherv to right group */
         root = 0;
@@ -809,8 +809,8 @@ int MPIR_Allgatherv_inter (
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
     else {
@@ -822,8 +822,8 @@ int MPIR_Allgatherv_inter (
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
         /* gatherv from left group */
         root = (rank == 0) ? MPI_ROOT : MPI_PROC_NULL;
@@ -833,8 +833,8 @@ int MPIR_Allgatherv_inter (
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
 
@@ -844,23 +844,23 @@ int MPIR_Allgatherv_inter (
     /* Get the local intracommunicator */
     if (!comm_ptr->local_comm) {
 	mpi_errno = MPIR_Setup_intercomm_localcomm( comm_ptr );
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     newcomm_ptr = comm_ptr->local_comm;
 
     mpi_errno = MPIR_Type_indexed_impl(remote_size, recvcounts, displs, recvtype, &newtype);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     
     mpi_errno = MPIR_Type_commit_impl(&newtype);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPIR_Bcast_intra(recvbuf, 1, newtype, 0, newcomm_ptr, errflag);
     if (mpi_errno) {
         /* for communication errors, just record the error but continue */
         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
     }
 
     MPIR_Type_free_impl(&newtype);
@@ -869,7 +869,7 @@ int MPIR_Allgatherv_inter (
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, MPI_ERR_OTHER, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, MPI_ERR_OTHER, "**coll_fail");
 
     return mpi_errno;
  fn_fail:
@@ -889,7 +889,7 @@ int MPIR_Allgatherv_inter (
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allgatherv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                     void *recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype,
                     MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
@@ -901,13 +901,13 @@ int MPIR_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
         mpi_errno = MPIR_Allgatherv_intra(sendbuf, sendcount, sendtype,
                                           recvbuf, recvcounts, displs, recvtype,
                                           comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     } else {
         /* intracommunicator */
         mpi_errno = MPIR_Allgatherv_inter(sendbuf, sendcount, sendtype,
                                           recvbuf, recvcounts, displs, recvtype,
                                           comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
  fn_exit:
@@ -925,7 +925,7 @@ int MPIR_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allgatherv_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Allgatherv_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                          void *recvbuf, const int *recvcounts, const int *displs,
                          MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
@@ -936,12 +936,12 @@ int MPIR_Allgatherv_impl(const void *sendbuf, int sendcount, MPI_Datatype sendty
 	/* --BEGIN USEREXTENSION-- */
 	mpi_errno = comm_ptr->coll_fns->Allgatherv(sendbuf, sendcount, sendtype,
                                                    recvbuf, recvcounts, displs, recvtype, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	/* --END USEREXTENSION-- */
     } else {
         mpi_errno = MPIR_Allgatherv(sendbuf, sendcount, sendtype,
                                     recvbuf, recvcounts, displs, recvtype, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
  fn_exit:
@@ -958,7 +958,7 @@ int MPIR_Allgatherv_impl(const void *sendbuf, int sendcount, MPI_Datatype sendty
 #undef FUNCNAME
 #define FUNCNAME MPI_Allgatherv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 
 MPI_Allgatherv - Gathers data from all tasks and deliver the combined data
@@ -1018,7 +1018,7 @@ int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_ALLGATHERV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -1111,7 +1111,7 @@ int MPI_Allgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_ALLGATHERV);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/allred_group.c b/src/mpi/coll/allred_group.c
index 18cd2bc..7a6d279 100644
--- a/src/mpi/coll/allred_group.c
+++ b/src/mpi/coll/allred_group.c
@@ -17,14 +17,14 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
     do {                                                                                                      \
         int gr_tmp_ = (gr_);                                                                                  \
         mpi_errno = MPIR_Group_translate_ranks_impl(group_ptr, 1, &(gr_tmp_), comm_ptr->local_group, &(cr_)); \
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);                                                               \
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);                                                               \
         MPIU_Assert((cr_) != MPI_UNDEFINED);                                                                  \
     } while (0)
 
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allreduce_group_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
                                MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr,
                                MPID_Group *group_ptr, int tag, MPIR_Errflag_t *errflag)
@@ -50,7 +50,7 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
 
     group_rank = group_ptr->rank;
     group_size = group_ptr->size;
-    MPIU_ERR_CHKANDJUMP(group_rank == MPI_UNDEFINED, mpi_errno, MPI_ERR_OTHER, "**rank");
+    MPIR_ERR_CHKANDJUMP(group_rank == MPI_UNDEFINED, mpi_errno, MPI_ERR_OTHER, "**rank");
 
     is_commutative = MPIR_Op_is_commutative(op);
 
@@ -68,7 +68,7 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
     if (sendbuf != MPI_IN_PLACE) {
         mpi_errno = MPIR_Localcopy(sendbuf, count, datatype, recvbuf,
                                    count, datatype);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     MPID_Datatype_get_size_macro(datatype, type_size);
@@ -95,8 +95,8 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
 
             /* temporarily set the rank to -1 so that this
@@ -113,15 +113,15 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
 
             /* do the reduction on received data. since the
                ordering is right, it doesn't matter whether
                the operation is commutative or not. */
             mpi_errno = MPIR_Reduce_local_impl(tmp_buf, recvbuf, count, datatype, op);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
             /* change the rank */
             newrank = group_rank / 2;
@@ -162,8 +162,8 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 } else {
 
                     /* tmp_buf contains data received in this step.
@@ -172,17 +172,17 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
                     if (is_commutative  || (dst < group_rank)) {
                         /* op is commutative OR the order is already right */
                         mpi_errno = MPIR_Reduce_local_impl(tmp_buf, recvbuf, count, datatype, op);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     }
                     else {
                         /* op is noncommutative and the order is not right */
                         mpi_errno = MPIR_Reduce_local_impl(recvbuf, tmp_buf, count, datatype, op);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
                         /* copy result back into recvbuf */
                         mpi_errno = MPIR_Localcopy(tmp_buf, count, datatype,
                                 recvbuf, count, datatype);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     }
                 }
                 mask <<= 1;
@@ -246,8 +246,8 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
 
                 /* tmp_buf contains data received in this step.
@@ -258,7 +258,7 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
                 mpi_errno = MPIR_Reduce_local_impl(((char *) tmp_buf + disps[recv_idx]*extent),
                                                    ((char *) recvbuf + disps[recv_idx]*extent),
                                                    recv_cnt, datatype, op);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
                 /* update send_idx for next iteration */
                 send_idx = recv_idx;
@@ -312,8 +312,8 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
 
                 if (newrank > newdst) send_idx = recv_idx;
@@ -343,8 +343,8 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
 
@@ -353,7 +353,7 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     return (mpi_errno);
 
   fn_fail:
@@ -363,18 +363,18 @@ int MPIR_Allreduce_group_intra(void *sendbuf, void *recvbuf, int count,
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allreduce_group
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Allreduce_group(void *sendbuf, void *recvbuf, int count,
                          MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr,
                          MPID_Group *group_ptr, int tag, MPIR_Errflag_t *errflag)
 {
     int mpi_errno = MPI_SUCCESS;
 
-    MPIU_ERR_CHKANDJUMP(comm_ptr->comm_kind != MPID_INTRACOMM, mpi_errno, MPI_ERR_OTHER, "**commnotintra");
+    MPIR_ERR_CHKANDJUMP(comm_ptr->comm_kind != MPID_INTRACOMM, mpi_errno, MPI_ERR_OTHER, "**commnotintra");
 
     mpi_errno = MPIR_Allreduce_group_intra(sendbuf, recvbuf, count, datatype,
                                            op, comm_ptr, group_ptr, tag, errflag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     fn_exit:
         return mpi_errno;
diff --git a/src/mpi/coll/allreduce.c b/src/mpi/coll/allreduce.c
index 75dab4b..c6cdf94 100644
--- a/src/mpi/coll/allreduce.c
+++ b/src/mpi/coll/allreduce.c
@@ -147,7 +147,7 @@ MPIR_Op_check_dtype_fn *MPIR_Op_check_dtype_table[] = {
 #undef FUNCNAME
 #define FUNCNAME allreduce_intra_or_coll_fn
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 static inline int allreduce_intra_or_coll_fn(void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op,
                                              MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
 {
@@ -156,11 +156,11 @@ static inline int allreduce_intra_or_coll_fn(void *sendbuf, void *recvbuf, int c
     if (comm_ptr->coll_fns != NULL && comm_ptr->coll_fns->Allreduce != NULL) {
 	/* --BEGIN USEREXTENSION-- */
 	mpi_errno = comm_ptr->coll_fns->Allreduce(sendbuf, recvbuf, count, datatype, op, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	/* --END USEREXTENSION-- */
     } else {
         mpi_errno = MPIR_Allreduce_intra(sendbuf, recvbuf, count, datatype, op, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
         
  fn_exit:
@@ -175,7 +175,7 @@ static inline int allreduce_intra_or_coll_fn(void *sendbuf, void *recvbuf, int c
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allreduce_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Allreduce_intra ( 
     const void *sendbuf,
     void *recvbuf, 
@@ -227,23 +227,23 @@ int MPIR_Allreduce_intra (
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
             } else {
                 mpi_errno = MPIR_Reduce_impl(sendbuf, recvbuf, count, datatype, op, 0, comm_ptr->node_comm, errflag);
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
             }
         } else {
             /* only one process on the node. copy sendbuf to recvbuf */
             if (sendbuf != MPI_IN_PLACE) {
                 mpi_errno = MPIR_Localcopy(sendbuf, count, datatype, recvbuf, count, datatype);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
         }
 
@@ -254,8 +254,8 @@ int MPIR_Allreduce_intra (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
 
@@ -265,8 +265,8 @@ int MPIR_Allreduce_intra (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
         goto fn_exit;
@@ -289,16 +289,16 @@ int MPIR_Allreduce_intra (
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
 
         mpi_errno = MPIR_Bcast_impl( recvbuf, count, datatype, 0, comm_ptr, errflag );
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
     else 
@@ -325,7 +325,7 @@ int MPIR_Allreduce_intra (
         if (sendbuf != MPI_IN_PLACE) {
             mpi_errno = MPIR_Localcopy(sendbuf, count, datatype, recvbuf,
                                        count, datatype);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
 
         MPID_Datatype_get_size_macro(datatype, type_size);
@@ -351,8 +351,8 @@ int MPIR_Allreduce_intra (
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
                 
                 /* temporarily set the rank to -1 so that this
@@ -368,15 +368,15 @@ int MPIR_Allreduce_intra (
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
 
                 /* do the reduction on received data. since the
                    ordering is right, it doesn't matter whether
                    the operation is commutative or not. */
                 mpi_errno = MPIR_Reduce_local_impl(tmp_buf, recvbuf, count, datatype, op);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
                 /* change the rank */
                 newrank = rank / 2;
@@ -414,8 +414,8 @@ int MPIR_Allreduce_intra (
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
                     
                     /* tmp_buf contains data received in this step.
@@ -424,17 +424,17 @@ int MPIR_Allreduce_intra (
                     if (is_commutative  || (dst < rank)) {
                         /* op is commutative OR the order is already right */
                         mpi_errno = MPIR_Reduce_local_impl(tmp_buf, recvbuf, count, datatype, op);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     }
                     else {
                         /* op is noncommutative and the order is not right */
                         mpi_errno = MPIR_Reduce_local_impl(recvbuf, tmp_buf, count, datatype, op);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
                         /* copy result back into recvbuf */
                         mpi_errno = MPIR_Localcopy(tmp_buf, count, datatype,
                                                    recvbuf, count, datatype);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     }
                     mask <<= 1;
                 }
@@ -499,8 +499,8 @@ int MPIR_Allreduce_intra (
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
                     
                     /* tmp_buf contains data received in this step.
@@ -511,7 +511,7 @@ int MPIR_Allreduce_intra (
                     mpi_errno = MPIR_Reduce_local_impl(((char *) tmp_buf + disps[recv_idx]*extent),
                                                        ((char *) recvbuf + disps[recv_idx]*extent),
                                                        recv_cnt, datatype, op);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
                     /* update send_idx for next iteration */
                     send_idx = recv_idx;
@@ -564,8 +564,8 @@ int MPIR_Allreduce_intra (
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
 
                     if (newrank > newdst) send_idx = recv_idx;
@@ -591,8 +591,8 @@ int MPIR_Allreduce_intra (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
     }
@@ -616,7 +616,7 @@ int MPIR_Allreduce_intra (
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allreduce_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Allreduce_inter ( 
     const void *sendbuf,
     void *recvbuf, 
@@ -664,8 +664,8 @@ int MPIR_Allreduce_inter (
     if (mpi_errno) {
         /* for communication errors, just record the error but continue */
         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
     }
 
     /* Do a exchange between local and remote rank 0 on this intercommunicator */
@@ -676,8 +676,8 @@ int MPIR_Allreduce_inter (
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
 
@@ -687,8 +687,8 @@ int MPIR_Allreduce_inter (
     if (mpi_errno) {
         /* for communication errors, just record the error but continue */
         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
     }
 
   fn_exit:
@@ -697,7 +697,7 @@ int MPIR_Allreduce_inter (
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
 
     return mpi_errno;
 
@@ -712,7 +712,7 @@ int MPIR_Allreduce_inter (
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allreduce
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype,
                    MPI_Op op, MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
 {
@@ -721,12 +721,12 @@ int MPIR_Allreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype d
     if (comm_ptr->comm_kind == MPID_INTRACOMM) {
         /* intracommunicator */
         mpi_errno = MPIR_Allreduce_intra(sendbuf, recvbuf, count, datatype, op, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else {
         /* intercommunicator */
         mpi_errno = MPIR_Allreduce_inter(sendbuf, recvbuf, count, datatype, op, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
 fn_exit:
@@ -743,7 +743,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Allreduce_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Allreduce_impl(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr,
                         MPIR_Errflag_t *errflag)
 {
@@ -753,7 +753,7 @@ int MPIR_Allreduce_impl(const void *sendbuf, void *recvbuf, int count, MPI_Datat
     {
 	/* --BEGIN USEREXTENSION-- */
 	mpi_errno = comm_ptr->coll_fns->Allreduce(sendbuf, recvbuf, count, datatype, op, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	/* --END USEREXTENSION-- */
     }
     else
@@ -761,12 +761,12 @@ int MPIR_Allreduce_impl(const void *sendbuf, void *recvbuf, int count, MPI_Datat
         if (comm_ptr->comm_kind == MPID_INTRACOMM) {
             /* intracommunicator */
             mpi_errno = MPIR_Allreduce_intra(sendbuf, recvbuf, count, datatype, op, comm_ptr, errflag);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	}
         else {
             /* intercommunicator */
             mpi_errno = MPIR_Allreduce_inter(sendbuf, recvbuf, count, datatype, op, comm_ptr, errflag);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -821,7 +821,7 @@ int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_ALLREDUCE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -896,7 +896,7 @@ int MPI_Allreduce(const void *sendbuf, void *recvbuf, int count,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_ALLREDUCE);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/alltoall.c b/src/mpi/coll/alltoall.c
index a495944..657acf5 100644
--- a/src/mpi/coll/alltoall.c
+++ b/src/mpi/coll/alltoall.c
@@ -126,7 +126,7 @@ int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void
 #undef FUNCNAME
 #define FUNCNAME MPIR_Alltoall_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Alltoall_intra( 
     const void *sendbuf,
     int sendcount, 
@@ -189,8 +189,8 @@ int MPIR_Alltoall_intra(
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
                 }
                 else if (rank == j) {
@@ -203,8 +203,8 @@ int MPIR_Alltoall_intra(
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
                 }
             }
@@ -225,12 +225,12 @@ int MPIR_Alltoall_intra(
 			   rank*sendcount*sendtype_extent, 
                            (comm_size - rank)*sendcount, sendtype, recvbuf, 
                            (comm_size - rank)*recvcount, recvtype);
-	if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
+	if (mpi_errno) { MPIR_ERR_POP(mpi_errno); }
         mpi_errno = MPIR_Localcopy(sendbuf, rank*sendcount, sendtype, 
                         (char *) recvbuf + 
 				   (comm_size-rank)*recvcount*recvtype_extent, 
                                    rank*recvcount, recvtype);
-	if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
+	if (mpi_errno) { MPIR_ERR_POP(mpi_errno); }
         /* Input data is now stored in recvbuf with datatype recvtype */
 
         /* Now do Phase 2, the communication phase. It takes
@@ -261,14 +261,14 @@ int MPIR_Alltoall_intra(
 
             mpi_errno = MPIR_Type_create_indexed_block_impl(count, recvcount,
                                                             displs, recvtype, &newtype);
-	    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+	    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
             mpi_errno = MPIR_Type_commit_impl(&newtype);
-	    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+	    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
             position = 0;
             mpi_errno = MPIR_Pack_impl(recvbuf, 1, newtype, tmp_buf, pack_size, &position);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
             mpi_errno = MPIC_Sendrecv(tmp_buf, position, MPI_PACKED, dst,
                                          MPIR_ALLTOALL_TAG, recvbuf, 1, newtype,
@@ -277,8 +277,8 @@ int MPIR_Alltoall_intra(
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
 
             MPIR_Type_free_impl(&newtype);
@@ -301,11 +301,11 @@ int MPIR_Alltoall_intra(
         mpi_errno = MPIR_Localcopy((char *) recvbuf + (rank+1)*recvcount*recvtype_extent, 
                        (comm_size - rank - 1)*recvcount, recvtype, tmp_buf, 
                        (comm_size - rank - 1)*recvcount, recvtype);
-	if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
+	if (mpi_errno) { MPIR_ERR_POP(mpi_errno); }
         mpi_errno = MPIR_Localcopy(recvbuf, (rank+1)*recvcount, recvtype, 
                        (char *) tmp_buf + (comm_size-rank-1)*recvcount*recvtype_extent, 
                        (rank+1)*recvcount, recvtype);
-	if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
+	if (mpi_errno) { MPIR_ERR_POP(mpi_errno); }
 
         /* Blocks are in the reverse order now (comm_size-1 to 0). 
          * Reorder them to (0 to comm_size-1) and store them in recvbuf. */
@@ -315,7 +315,7 @@ int MPIR_Alltoall_intra(
                                        recvcount, recvtype, 
                                        (char *) recvbuf + (comm_size-i-1)*recvcount*recvtype_extent, 
                                        recvcount, recvtype);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -352,7 +352,7 @@ int MPIR_Alltoall_intra(
                                           recvcount, recvtype, dst,
                                           MPIR_ALLTOALL_TAG, comm_ptr,
                                           &reqarray[i]);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
 
             for ( i=0; i<ss; i++ ) { 
@@ -362,12 +362,12 @@ int MPIR_Alltoall_intra(
                                           sendcount, sendtype, dst,
                                           MPIR_ALLTOALL_TAG, comm_ptr,
                                           &reqarray[i+ss], errflag);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
   
             /* ... then wait for them to finish: */
             mpi_errno = MPIC_Waitall(2*ss,reqarray,starray, errflag);
-            if (mpi_errno && mpi_errno != MPI_ERR_IN_STATUS) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno && mpi_errno != MPI_ERR_IN_STATUS) MPIR_ERR_POP(mpi_errno);
             
             /* --BEGIN ERROR HANDLING-- */
             if (mpi_errno == MPI_ERR_IN_STATUS) {
@@ -377,8 +377,8 @@ int MPIR_Alltoall_intra(
                         if (mpi_errno) {
                             /* for communication errors, just record the error but continue */
                             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                         }
                     }
                 }
@@ -399,7 +399,7 @@ int MPIR_Alltoall_intra(
                                    ((char *)recvbuf +
                                     rank*recvcount*recvtype_extent),
                                    recvcount, recvtype);
-	if (mpi_errno) { MPIU_ERR_POP(mpi_errno ); }
+	if (mpi_errno) { MPIR_ERR_POP(mpi_errno ); }
 
         /* Is comm_size a power-of-two? */
         i = 1;
@@ -432,8 +432,8 @@ int MPIR_Alltoall_intra(
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
     }
@@ -445,7 +445,7 @@ int MPIR_Alltoall_intra(
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
 
     return mpi_errno;
  fn_fail:
@@ -460,7 +460,7 @@ int MPIR_Alltoall_intra(
 #undef FUNCNAME
 #define FUNCNAME MPIR_Alltoall_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Alltoall_inter( 
     const void *sendbuf,
     int sendcount, 
@@ -530,8 +530,8 @@ int MPIR_Alltoall_inter(
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
 
@@ -541,7 +541,7 @@ int MPIR_Alltoall_inter(
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
 
     return mpi_errno;
  fn_fail:
@@ -552,7 +552,7 @@ int MPIR_Alltoall_inter(
 #undef FUNCNAME
 #define FUNCNAME MPIR_Alltoall
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                   void *recvbuf, int recvcount, MPI_Datatype recvtype,
                   MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
@@ -564,13 +564,13 @@ int MPIR_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
         mpi_errno = MPIR_Alltoall_intra(sendbuf, sendcount, sendtype,
                                         recvbuf, recvcount, recvtype,
                                         comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     } else {
         /* intercommunicator */
         mpi_errno = MPIR_Alltoall_inter(sendbuf, sendcount, sendtype,
                                         recvbuf, recvcount, recvtype,
                                         comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
  fn_exit:
@@ -582,7 +582,7 @@ int MPIR_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 #undef FUNCNAME
 #define FUNCNAME MPIR_Alltoall_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Alltoall_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                        void *recvbuf, int recvcount, MPI_Datatype recvtype,
                        MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
@@ -593,13 +593,13 @@ int MPIR_Alltoall_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype
 	mpi_errno = comm_ptr->coll_fns->Alltoall(sendbuf, sendcount, sendtype,
                                                  recvbuf, recvcount, recvtype,
                                                  comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	/* --END USEREXTENSION-- */
     } else {
         mpi_errno = MPIR_Alltoall(sendbuf, sendcount, sendtype,
                                   recvbuf, recvcount, recvtype,
                                   comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     
  fn_exit:
@@ -614,7 +614,7 @@ int MPIR_Alltoall_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype
 #undef FUNCNAME
 #define FUNCNAME MPI_Alltoall
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Alltoall - Sends data from all to all processes
 
@@ -650,7 +650,7 @@ int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_ALLTOALL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -726,7 +726,7 @@ int MPI_Alltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_ALLTOALL);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/alltoallv.c b/src/mpi/coll/alltoallv.c
index 9c6b8d9..4fec383 100644
--- a/src/mpi/coll/alltoallv.c
+++ b/src/mpi/coll/alltoallv.c
@@ -59,7 +59,7 @@ int MPI_Alltoallv(const void *sendbuf, const int *sendcounts, const int *sdispls
 #undef FUNCNAME
 #define FUNCNAME MPIR_Alltoallv_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Alltoallv_intra(const void *sendbuf, const int *sendcounts, const int *sdispls,
                          MPI_Datatype sendtype, void *recvbuf, const int *recvcounts,
                          const int *rdispls, MPI_Datatype recvtype, MPID_Comm *comm_ptr,
@@ -110,8 +110,8 @@ int MPIR_Alltoallv_intra(const void *sendbuf, const int *sendcounts, const int *
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
 
                 }
@@ -125,8 +125,8 @@ int MPIR_Alltoallv_intra(const void *sendbuf, const int *sendcounts, const int *
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
                 }
             }
@@ -161,8 +161,8 @@ int MPIR_Alltoallv_intra(const void *sendbuf, const int *sendcounts, const int *
                         if (mpi_errno) {
                             /* for communication errors, just record the error but continue */
                             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                         }
                         req_cnt++;
                     }
@@ -183,8 +183,8 @@ int MPIR_Alltoallv_intra(const void *sendbuf, const int *sendcounts, const int *
                         if (mpi_errno) {
                             /* for communication errors, just record the error but continue */
                             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                         }
                         req_cnt++;
                     }
@@ -192,7 +192,7 @@ int MPIR_Alltoallv_intra(const void *sendbuf, const int *sendcounts, const int *
             }
 
             mpi_errno = MPIC_Waitall(req_cnt, reqarray, starray, errflag);
-            if (mpi_errno && mpi_errno != MPI_ERR_IN_STATUS) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno && mpi_errno != MPI_ERR_IN_STATUS) MPIR_ERR_POP(mpi_errno);
 
             /* --BEGIN ERROR HANDLING-- */
             if (mpi_errno == MPI_ERR_IN_STATUS) {
@@ -202,8 +202,8 @@ int MPIR_Alltoallv_intra(const void *sendbuf, const int *sendcounts, const int *
                         if (mpi_errno) {
                             /* for communication errors, just record the error but continue */
                             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                         }
                     }
                 }
@@ -220,7 +220,7 @@ fn_exit:
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
 
     return mpi_errno;
 
@@ -234,7 +234,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Alltoallv_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Alltoallv_inter(const void *sendbuf, const int *sendcounts, const int *sdispls,
                          MPI_Datatype sendtype, void *recvbuf, const int *recvcounts,
                          const int *rdispls, MPI_Datatype recvtype, MPID_Comm *comm_ptr,
@@ -306,8 +306,8 @@ int MPIR_Alltoallv_inter(const void *sendbuf, const int *sendcounts, const int *
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
 
@@ -317,7 +317,7 @@ int MPIR_Alltoallv_inter(const void *sendbuf, const int *sendcounts, const int *
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     return mpi_errno;
  fn_fail:
     goto fn_exit;
@@ -327,7 +327,7 @@ int MPIR_Alltoallv_inter(const void *sendbuf, const int *sendcounts, const int *
 #undef FUNCNAME
 #define FUNCNAME MPIR_Alltoallv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Alltoallv(const void *sendbuf, const int *sendcounts, const int *sdispls,
                    MPI_Datatype sendtype, void *recvbuf, const int *recvcounts, const int *rdispls,
                    MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
@@ -339,13 +339,13 @@ int MPIR_Alltoallv(const void *sendbuf, const int *sendcounts, const int *sdispl
         mpi_errno = MPIR_Alltoallv_intra(sendbuf, sendcounts, sdispls,
                                          sendtype, recvbuf, recvcounts,
                                          rdispls, recvtype, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     } else {
         /* intercommunicator */
         mpi_errno = MPIR_Alltoallv_inter(sendbuf, sendcounts, sdispls,
                                          sendtype, recvbuf, recvcounts,
                                          rdispls, recvtype, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
  fn_exit:
@@ -357,7 +357,7 @@ int MPIR_Alltoallv(const void *sendbuf, const int *sendcounts, const int *sdispl
 #undef FUNCNAME
 #define FUNCNAME MPIR_Alltoallv_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Alltoallv_impl(const void *sendbuf, const int *sendcounts, const int *sdispls,
                         MPI_Datatype sendtype, void *recvbuf, const int *recvcounts,
                         const int *rdispls, MPI_Datatype recvtype,
@@ -370,13 +370,13 @@ int MPIR_Alltoallv_impl(const void *sendbuf, const int *sendcounts, const int *s
 	mpi_errno = comm_ptr->coll_fns->Alltoallv(sendbuf, sendcounts, sdispls,
                                                  sendtype, recvbuf, recvcounts,
                                                  rdispls, recvtype, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	/* --END USEREXTENSION-- */
     } else {
         mpi_errno = MPIR_Alltoallv(sendbuf, sendcounts, sdispls,
                                    sendtype, recvbuf, recvcounts,
                                    rdispls, recvtype, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
  fn_exit:
@@ -393,7 +393,7 @@ int MPIR_Alltoallv_impl(const void *sendbuf, const int *sendcounts, const int *s
 #undef FUNCNAME
 #define FUNCNAME MPI_Alltoallv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Alltoallv - Sends data from all to all processes; each process may 
    send a different amount of data and provide displacements for the input
@@ -441,7 +441,7 @@ int MPI_Alltoallv(const void *sendbuf, const int *sendcounts,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_ALLTOALLV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -479,7 +479,7 @@ int MPI_Alltoallv(const void *sendbuf, const int *sendcounts,
                 comm_size = comm_ptr->remote_size;
 
             if (comm_ptr->comm_kind == MPID_INTERCOMM && sendbuf == MPI_IN_PLACE) {
-                MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**sendbuf_inplace");
+                MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**sendbuf_inplace");
             }
 
             for (i=0; i<comm_size; i++) {
@@ -533,7 +533,7 @@ int MPI_Alltoallv(const void *sendbuf, const int *sendcounts,
 
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_ALLTOALLV);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/alltoallw.c b/src/mpi/coll/alltoallw.c
index a9f551c..0335f85 100644
--- a/src/mpi/coll/alltoallw.c
+++ b/src/mpi/coll/alltoallw.c
@@ -53,7 +53,7 @@ int MPI_Alltoallw(const void *sendbuf, const int sendcounts[], const int sdispls
 #undef FUNCNAME
 #define FUNCNAME MPIR_Alltoallw_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Alltoallw_intra(const void *sendbuf, const int sendcounts[], const int sdispls[],
                          const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[],
                          const int rdispls[], const MPI_Datatype recvtypes[], MPID_Comm *comm_ptr,
@@ -100,8 +100,8 @@ int MPIR_Alltoallw_intra(const void *sendbuf, const int sendcounts[], const int
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
                 }
                 else if (rank == j) {
@@ -114,8 +114,8 @@ int MPIR_Alltoallw_intra(const void *sendbuf, const int sendcounts[], const int
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
                 }
             }
@@ -143,7 +143,7 @@ int MPIR_Alltoallw_intra(const void *sendbuf, const int sendcounts[], const int
                                                   recvcounts[dst], recvtypes[dst], dst,
                                                   MPIR_ALLTOALLW_TAG, comm_ptr,
                                                   &reqarray[outstanding_requests]);
-                        if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
+                        if (mpi_errno) { MPIR_ERR_POP(mpi_errno); }
 
                         outstanding_requests++;
                     }
@@ -159,7 +159,7 @@ int MPIR_Alltoallw_intra(const void *sendbuf, const int sendcounts[], const int
                                                   sendcounts[dst], sendtypes[dst], dst,
                                                   MPIR_ALLTOALLW_TAG, comm_ptr,
                                                   &reqarray[outstanding_requests], errflag);
-                        if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
+                        if (mpi_errno) { MPIR_ERR_POP(mpi_errno); }
 
                         outstanding_requests++;
                     }
@@ -167,7 +167,7 @@ int MPIR_Alltoallw_intra(const void *sendbuf, const int sendcounts[], const int
             }
 
             mpi_errno = MPIC_Waitall(outstanding_requests, reqarray, starray, errflag);
-            if (mpi_errno && mpi_errno != MPI_ERR_IN_STATUS) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno && mpi_errno != MPI_ERR_IN_STATUS) MPIR_ERR_POP(mpi_errno);
             
             /* --BEGIN ERROR HANDLING-- */
             if (mpi_errno == MPI_ERR_IN_STATUS) {
@@ -177,8 +177,8 @@ int MPIR_Alltoallw_intra(const void *sendbuf, const int sendcounts[], const int
                         if (mpi_errno) {
                             /* for communication errors, just record the error but continue */
                             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                         }
                     }
                 }
@@ -194,7 +194,7 @@ int MPIR_Alltoallw_intra(const void *sendbuf, const int sendcounts[], const int
                                    sendcounts[rank], sendtypes[rank],
                                    ((char *)recvbuf+rdispls[rank]), 
                                    recvcounts[rank], recvtypes[rank]);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         /* Do the pairwise exchange. */
         for (i=1; i<comm_size; i++) {
             src = (rank - i + comm_size) % comm_size;
@@ -208,8 +208,8 @@ int MPIR_Alltoallw_intra(const void *sendbuf, const int sendcounts[], const int
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
 #endif
@@ -222,7 +222,7 @@ int MPIR_Alltoallw_intra(const void *sendbuf, const int sendcounts[], const int
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     return mpi_errno;
 
   fn_fail:
@@ -234,7 +234,7 @@ int MPIR_Alltoallw_intra(const void *sendbuf, const int sendcounts[], const int
 #undef FUNCNAME
 #define FUNCNAME MPIR_Alltoallw_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Alltoallw_inter(const void *sendbuf, const int sendcounts[], const int sdispls[],
                          const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[],
                          const int rdispls[], const MPI_Datatype recvtypes[], MPID_Comm *comm_ptr,
@@ -301,8 +301,8 @@ int MPIR_Alltoallw_inter(const void *sendbuf, const int sendcounts[], const int
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
     
@@ -312,7 +312,7 @@ int MPIR_Alltoallw_inter(const void *sendbuf, const int sendcounts[], const int
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     return mpi_errno;
  fn_fail:
     goto fn_exit;
@@ -321,7 +321,7 @@ int MPIR_Alltoallw_inter(const void *sendbuf, const int sendcounts[], const int
 #undef FUNCNAME
 #define FUNCNAME MPIR_Alltoallw
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Alltoallw(const void *sendbuf, const int sendcounts[], const int sdispls[],
                    const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[],
                    const int rdispls[], const MPI_Datatype recvtypes[],
@@ -334,13 +334,13 @@ int MPIR_Alltoallw(const void *sendbuf, const int sendcounts[], const int sdispl
         mpi_errno = MPIR_Alltoallw_intra(sendbuf, sendcounts, sdispls,
                                          sendtypes, recvbuf, recvcounts,
                                          rdispls, recvtypes, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     } else {
         /* intercommunicator */
         mpi_errno = MPIR_Alltoallw_inter(sendbuf, sendcounts, sdispls,
                                          sendtypes, recvbuf, recvcounts,
                                          rdispls, recvtypes, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
  fn_exit:
@@ -352,7 +352,7 @@ int MPIR_Alltoallw(const void *sendbuf, const int sendcounts[], const int sdispl
 #undef FUNCNAME
 #define FUNCNAME MPIR_Alltoallw_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Alltoallw_impl(const void *sendbuf, const int sendcounts[], const int sdispls[],
                         const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[],
                         const int rdispls[], const MPI_Datatype recvtypes[],
@@ -365,13 +365,13 @@ int MPIR_Alltoallw_impl(const void *sendbuf, const int sendcounts[], const int s
 	mpi_errno = comm_ptr->coll_fns->Alltoallw(sendbuf, sendcounts, sdispls,
                                                   sendtypes, recvbuf, recvcounts,
                                                   rdispls, recvtypes, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	/* --END USEREXTENSION-- */
     } else {
         mpi_errno = MPIR_Alltoallw(sendbuf, sendcounts, sdispls,
                                    sendtypes, recvbuf, recvcounts,
                                    rdispls, recvtypes, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
  fn_exit:
@@ -387,7 +387,7 @@ int MPIR_Alltoallw_impl(const void *sendbuf, const int sendcounts[], const int s
 #undef FUNCNAME
 #define FUNCNAME MPI_Alltoallw
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
    MPI_Alltoallw - Generalized all-to-all communication allowing different
    datatypes, counts, and displacements for each partner
@@ -436,7 +436,7 @@ int MPI_Alltoallw(const void *sendbuf, const int sendcounts[],
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_ALLTOALLW);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -468,7 +468,7 @@ int MPI_Alltoallw(const void *sendbuf, const int sendcounts[],
             check_send = (comm_ptr->comm_kind == MPID_INTRACOMM && sendbuf != MPI_IN_PLACE);
 
             if (comm_ptr->comm_kind == MPID_INTERCOMM && sendbuf == MPI_IN_PLACE) {
-                MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**sendbuf_inplace");
+                MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**sendbuf_inplace");
             }
 
             if (comm_ptr->comm_kind == MPID_INTRACOMM) {
@@ -539,7 +539,7 @@ int MPI_Alltoallw(const void *sendbuf, const int sendcounts[],
 
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_ALLTOALLW);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/barrier.c b/src/mpi/coll/barrier.c
index 8d624e1..a76d881 100644
--- a/src/mpi/coll/barrier.c
+++ b/src/mpi/coll/barrier.c
@@ -66,7 +66,7 @@ int MPI_Barrier(MPI_Comm comm) __attribute__((weak,alias("PMPI_Barrier")));
 #undef FUNCNAME
 #define FUNCNAME barrier_smp_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 static int barrier_smp_intra(MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
 {
     int mpi_errno=MPI_SUCCESS;
@@ -82,8 +82,8 @@ static int barrier_smp_intra(MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
 
@@ -93,8 +93,8 @@ static int barrier_smp_intra(MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
 
@@ -108,8 +108,8 @@ static int barrier_smp_intra(MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
 
@@ -117,7 +117,7 @@ static int barrier_smp_intra(MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     return mpi_errno;
  fn_fail:
     goto fn_exit;
@@ -127,7 +127,7 @@ static int barrier_smp_intra(MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
 #undef FUNCNAME
 #define FUNCNAME MPIR_Barrier_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Barrier_intra( MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag )
 {
     int size, rank, src, dst, mask, mpi_errno=MPI_SUCCESS;
@@ -147,8 +147,8 @@ int MPIR_Barrier_intra( MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag )
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
         goto fn_exit;
     }
@@ -166,8 +166,8 @@ int MPIR_Barrier_intra( MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag )
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
         mask <<= 1;
     }
@@ -177,7 +177,7 @@ int MPIR_Barrier_intra( MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag )
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     return mpi_errno;
  fn_fail:
     goto fn_exit;
@@ -188,7 +188,7 @@ int MPIR_Barrier_intra( MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag )
 #undef FUNCNAME
 #define FUNCNAME MPIR_Barrier_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Barrier_inter( MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag )
 {
     int rank, mpi_errno = MPI_SUCCESS, root;
@@ -201,7 +201,7 @@ int MPIR_Barrier_inter( MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag )
     /* Get the local intracommunicator */
     if (!comm_ptr->local_comm) {
 	mpi_errno = MPIR_Setup_intercomm_localcomm( comm_ptr );
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     newcomm_ptr = comm_ptr->local_comm;
@@ -211,8 +211,8 @@ int MPIR_Barrier_inter( MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag )
     if (mpi_errno) {
         /* for communication errors, just record the error but continue */
         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
     }
 
     /* rank 0 on each group does an intercommunicator broadcast to the
@@ -229,8 +229,8 @@ int MPIR_Barrier_inter( MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag )
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
 
         /* receive bcast from right */
@@ -239,8 +239,8 @@ int MPIR_Barrier_inter( MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag )
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
     else {
@@ -250,8 +250,8 @@ int MPIR_Barrier_inter( MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag )
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
 
         /* bcast to left */
@@ -260,28 +260,28 @@ int MPIR_Barrier_inter( MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag )
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
  fn_exit:
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     return mpi_errno;
  fn_fail:
     goto fn_exit;
 }
 
-/* MPIR_Barrier performs an barrier using poin        MPIU_ERR_CHKANDJUMP(errflag, mpi_errno, MPI_ERR_OTHER, "**coll_fail");
+/* MPIR_Barrier performs an barrier using poin        MPIR_ERR_CHKANDJUMP(errflag, mpi_errno, MPI_ERR_OTHER, "**coll_fail");
 t-to-point messages.
    This is intended to be used by device-specific implementations of
    barrier.  In all other cases MPIR_Barrier_impl should be used. */
 #undef FUNCNAME
 #define FUNCNAME MPIR_Barrier
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Barrier(MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -289,11 +289,11 @@ int MPIR_Barrier(MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
     if (comm_ptr->comm_kind == MPID_INTRACOMM) {
         /* intracommunicator */
         mpi_errno = MPIR_Barrier_intra( comm_ptr, errflag );
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     } else {
         /* intercommunicator */
         mpi_errno = MPIR_Barrier_inter( comm_ptr, errflag );
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
  fn_exit:
@@ -310,7 +310,7 @@ int MPIR_Barrier(MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
 #undef FUNCNAME
 #define FUNCNAME MPIR_Barrier_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Barrier_impl(MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -318,18 +318,18 @@ int MPIR_Barrier_impl(MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
     {
 	/* --BEGIN USEREXTENSION-- */
 	mpi_errno = comm_ptr->coll_fns->Barrier(comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	/* --END USEREXTENSION-- */
     }
     else
     {
         mpi_errno = MPIR_Barrier(comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
         
  fn_exit:
     if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     return mpi_errno;
  fn_fail:
     goto fn_exit;
@@ -343,7 +343,7 @@ int MPIR_Barrier_impl(MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
 #undef FUNCNAME
 #define FUNCNAME MPI_Barrier
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 
 /*@
 
@@ -375,7 +375,7 @@ int MPI_Barrier( MPI_Comm comm )
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_BARRIER);
     
     /* Validate parameters, especially handles needing to be converted */
@@ -414,7 +414,7 @@ int MPI_Barrier( MPI_Comm comm )
 
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_BARRIER);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/bcast.c b/src/mpi/coll/bcast.c
index 5ea65e5..1bbbcb4 100644
--- a/src/mpi/coll/bcast.c
+++ b/src/mpi/coll/bcast.c
@@ -120,7 +120,7 @@ int MPI_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Comm
 #undef FUNCNAME
 #define FUNCNAME MPIR_Bcast_binomial
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 static int MPIR_Bcast_binomial(
     void *buffer, 
     int count, 
@@ -189,7 +189,7 @@ static int MPIR_Bcast_binomial(
         if (rank == root) {
             mpi_errno = MPIR_Pack_impl(buffer, count, datatype, tmp_buf, nbytes,
                                        &position);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -236,8 +236,8 @@ static int MPIR_Bcast_binomial(
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
 
             /* check that we received as much as we expected */
@@ -245,10 +245,10 @@ static int MPIR_Bcast_binomial(
             /* recvd_size may not be accurate for packed heterogeneous data */
             if (is_homogeneous && recvd_size != nbytes) {
                 if (*errflag == MPIR_ERR_NONE) *errflag = MPIR_ERR_OTHER;
-                MPIU_ERR_SET2(mpi_errno, MPI_ERR_OTHER,
+                MPIR_ERR_SET2(mpi_errno, MPI_ERR_OTHER,
 		      "**collective_size_mismatch",
 		      "**collective_size_mismatch %d %d", recvd_size, nbytes );
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
             break;
         }
@@ -282,8 +282,8 @@ static int MPIR_Bcast_binomial(
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
         mask >>= 1;
@@ -296,7 +296,7 @@ static int MPIR_Bcast_binomial(
             position = 0;
             mpi_errno = MPIR_Unpack_impl(tmp_buf, nbytes, &position, buffer,
                                          count, datatype);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             
         }
     }
@@ -307,7 +307,7 @@ fn_exit:
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     /* --END ERROR HANDLING-- */
     return mpi_errno;
 fn_fail:
@@ -327,7 +327,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME scatter_for_bcast
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 static int scatter_for_bcast(
     void *buffer ATTRIBUTE((unused)),
     int count ATTRIBUTE((unused)), 
@@ -392,8 +392,8 @@ static int scatter_for_bcast(
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     curr_size = 0;
                 } else
                     /* query actual size of data received */
@@ -428,8 +428,8 @@ static int scatter_for_bcast(
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
 
                 curr_size -= send_size;
@@ -443,7 +443,7 @@ fn_exit:
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     /* --END ERROR HANDLING-- */
     return mpi_errno;
 fn_fail:
@@ -473,7 +473,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Bcast_scatter_doubling_allgather
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 static int MPIR_Bcast_scatter_doubling_allgather(
     void *buffer, 
     int count, 
@@ -552,7 +552,7 @@ static int MPIR_Bcast_scatter_doubling_allgather(
         if (rank == root) {
             mpi_errno = MPIR_Pack_impl(buffer, count, datatype, tmp_buf, nbytes,
                                        &position);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -564,8 +564,8 @@ static int MPIR_Bcast_scatter_doubling_allgather(
     if (mpi_errno) {
         /* for communication errors, just record the error but continue */
         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
     }
 
     /* curr_size is the amount of data that this process now has stored in
@@ -610,8 +610,8 @@ static int MPIR_Bcast_scatter_doubling_allgather(
 		/* --BEGIN ERROR HANDLING-- */
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 recv_size = 0;
 		/* --END ERROR HANDLING-- */
             } else
@@ -686,8 +686,8 @@ static int MPIR_Bcast_scatter_doubling_allgather(
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
                 }
                 /* recv only if this proc. doesn't have data and sender
@@ -708,8 +708,8 @@ static int MPIR_Bcast_scatter_doubling_allgather(
 			/* --BEGIN ERROR HANDLING-- */
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                         recv_size = 0;
 			/* --END ERROR HANDLING-- */
                     } else
@@ -732,10 +732,10 @@ static int MPIR_Bcast_scatter_doubling_allgather(
     /* recvd_size may not be accurate for packed heterogeneous data */
     if (is_homogeneous && curr_size != nbytes) {
         if (*errflag == MPIR_ERR_NONE) *errflag = MPIR_ERR_OTHER;
-        MPIU_ERR_SET2(mpi_errno, MPI_ERR_OTHER,
+        MPIR_ERR_SET2(mpi_errno, MPI_ERR_OTHER,
 		      "**collective_size_mismatch",
 		      "**collective_size_mismatch %d %d", curr_size, nbytes );
-        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
     }
 
     if (!is_contig || !is_homogeneous)
@@ -745,7 +745,7 @@ static int MPIR_Bcast_scatter_doubling_allgather(
             position = 0;
             mpi_errno = MPIR_Unpack_impl(tmp_buf, nbytes, &position, buffer,
                                          count, datatype);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -755,7 +755,7 @@ fn_exit:
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     /* --END ERROR HANDLING-- */
     return mpi_errno;
 fn_fail:
@@ -781,7 +781,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Bcast_scatter_ring_allgather
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 static int MPIR_Bcast_scatter_ring_allgather(
     void *buffer, 
     int count, 
@@ -858,7 +858,7 @@ static int MPIR_Bcast_scatter_ring_allgather(
         if (rank == root) {
             mpi_errno = MPIR_Pack_impl(buffer, count, datatype, tmp_buf, nbytes,
                                        &position);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -869,8 +869,8 @@ static int MPIR_Bcast_scatter_ring_allgather(
     if (mpi_errno) {
         /* for communication errors, just record the error but continue */
         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
     }
 
     /* long-message allgather or medium-size but non-power-of-two. use ring algorithm. */ 
@@ -908,8 +908,8 @@ static int MPIR_Bcast_scatter_ring_allgather(
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
         MPIR_Get_count_impl(&status, MPI_BYTE, &recvd_size);
         curr_size += recvd_size;
@@ -921,10 +921,10 @@ static int MPIR_Bcast_scatter_ring_allgather(
     /* recvd_size may not be accurate for packed heterogeneous data */
     if (is_homogeneous && curr_size != nbytes) {
         if (*errflag == MPIR_ERR_NONE) *errflag = MPIR_ERR_OTHER;
-        MPIU_ERR_SET2(mpi_errno, MPI_ERR_OTHER,
+        MPIR_ERR_SET2(mpi_errno, MPI_ERR_OTHER,
 		      "**collective_size_mismatch",
 		      "**collective_size_mismatch %d %d", curr_size, nbytes );
-        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
     }
 
     if (!is_contig || !is_homogeneous)
@@ -934,7 +934,7 @@ static int MPIR_Bcast_scatter_ring_allgather(
             position = 0;
             mpi_errno = MPIR_Unpack_impl(tmp_buf, nbytes, &position, buffer,
                                          count, datatype);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -944,7 +944,7 @@ fn_exit:
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     /* --END ERROR HANDLING-- */
     return mpi_errno;
 fn_fail:
@@ -955,7 +955,7 @@ fn_fail:
    Invokes the coll_fns->Bcast override for the given communicator if non-null.
    Otherwise it invokes bcast_fn_ with the given args.
    
-   NOTE: calls MPIU_ERR_POP on any failure, so a fn_fail label is needed. */
+   NOTE: calls MPIR_ERR_POP on any failure, so a fn_fail label is needed. */
 #define MPIR_Bcast_fn_or_override(bcast_fn_,mpi_errno_ret_,buffer_,count_,datatype_,root_,comm_ptr_,errflag_) \
     do {                                                                                         \
         int mpi_errno_ = MPI_SUCCESS;                                                            \
@@ -973,8 +973,8 @@ fn_fail:
         if (mpi_errno_) {                                                                        \
             /* for communication errors, just record the error but continue */                   \
             *(errflag_) = MPIR_ERR_GET_CLASS(mpi_errno_);                                        \
-            MPIU_ERR_SET(mpi_errno_, *(errflag_), "**fail");                                     \
-            MPIU_ERR_ADD(mpi_errno_ret_, mpi_errno_);                                            \
+            MPIR_ERR_SET(mpi_errno_, *(errflag_), "**fail");                                     \
+            MPIR_ERR_ADD(mpi_errno_ret_, mpi_errno_);                                            \
         }                                                                                        \
     } while (0)
 
@@ -987,7 +987,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_SMP_Bcast
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 static int MPIR_SMP_Bcast(
         void *buffer, 
         int count, 
@@ -1044,8 +1044,8 @@ static int MPIR_SMP_Bcast(
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
             }
             else if (0 == comm_ptr->node_comm->rank) {
@@ -1054,19 +1054,19 @@ static int MPIR_SMP_Bcast(
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
                 /* check that we received as much as we expected */
                 MPIR_Get_count_impl(&status, MPI_BYTE, &recvd_size);
                 /* recvd_size may not be accurate for packed heterogeneous data */
                 if (is_homogeneous && recvd_size != nbytes) {
                     if (*errflag == MPIR_ERR_NONE) *errflag = MPIR_ERR_OTHER;
-                    MPIU_ERR_SET2(mpi_errno, MPI_ERR_OTHER,
+                    MPIR_ERR_SET2(mpi_errno, MPI_ERR_OTHER,
 				  "**collective_size_mismatch",
 				  "**collective_size_mismatch %d %d", 
 				  recvd_size, nbytes );
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
             }
             
@@ -1149,8 +1149,8 @@ static int MPIR_SMP_Bcast(
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
     }
@@ -1160,7 +1160,7 @@ fn_exit:
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     /* --END ERROR HANDLING-- */
     return mpi_errno;
 fn_fail:
@@ -1213,7 +1213,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Bcast_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /* not declared static because it is called in intercomm. allgatherv */
 int MPIR_Bcast_intra ( 
         void *buffer, 
@@ -1246,8 +1246,8 @@ int MPIR_Bcast_intra (
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
         goto fn_exit;
     }
@@ -1284,8 +1284,8 @@ int MPIR_Bcast_intra (
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
     else /* (nbytes >= MPIR_CVAR_BCAST_SHORT_MSG_SIZE) && (comm_size >= MPIR_CVAR_BCAST_MIN_PROCS) */
@@ -1296,8 +1296,8 @@ int MPIR_Bcast_intra (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
         else /* (nbytes >= MPIR_CVAR_BCAST_LONG_MSG_SIZE) || !(comm_size_is_pof2) */
@@ -1309,8 +1309,8 @@ int MPIR_Bcast_intra (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
     }
@@ -1325,7 +1325,7 @@ fn_exit:
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     /* --END ERROR HANDLING-- */
     return mpi_errno;
 fn_fail:
@@ -1336,7 +1336,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Bcast_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 
 /* Not PMPI_LOCAL because it is called in intercomm allgather */
 int MPIR_Bcast_inter ( 
@@ -1374,8 +1374,8 @@ int MPIR_Bcast_inter (
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
         MPIDU_ERR_CHECK_MULTIPLE_THREADS_EXIT( comm_ptr );
     }
@@ -1392,8 +1392,8 @@ int MPIR_Bcast_inter (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
         
@@ -1409,8 +1409,8 @@ int MPIR_Bcast_inter (
         if (mpi_errno) {
             /* for communication errors, just record the error but continue */
             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
         }
     }
 
@@ -1420,7 +1420,7 @@ fn_fail:
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, MPI_ERR_OTHER, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, MPI_ERR_OTHER, "**coll_fail");
     /* --END ERROR HANDLING-- */
     return mpi_errno;
 }
@@ -1433,7 +1433,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Bcast_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Bcast_impl(void *buffer, int count, MPI_Datatype datatype, int root, MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -1443,13 +1443,13 @@ int MPIR_Bcast_impl(void *buffer, int count, MPI_Datatype datatype, int root, MP
 	/* --BEGIN USEREXTENSION-- */
 	mpi_errno = comm_ptr->coll_fns->Bcast(buffer, count,
                                               datatype, root, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	/* --END USEREXTENSION-- */
     }
     else
     {
         mpi_errno = MPIR_Bcast(buffer, count, datatype, root, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
 
@@ -1465,7 +1465,7 @@ int MPIR_Bcast_impl(void *buffer, int count, MPI_Datatype datatype, int root, MP
 #undef FUNCNAME
 #define FUNCNAME MPIR_Bcast
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 inline int MPIR_Bcast(void *buffer, int count, MPI_Datatype datatype, int root, MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -1473,12 +1473,12 @@ inline int MPIR_Bcast(void *buffer, int count, MPI_Datatype datatype, int root,
     if (comm_ptr->comm_kind == MPID_INTRACOMM) {
         /* intracommunicator */
         mpi_errno = MPIR_Bcast_intra( buffer, count, datatype, root, comm_ptr, errflag );
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         
     } else {
         /* intercommunicator */
         mpi_errno = MPIR_Bcast_inter( buffer, count, datatype, root, comm_ptr, errflag );
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
  fn_exit:
@@ -1493,7 +1493,7 @@ inline int MPIR_Bcast(void *buffer, int count, MPI_Datatype datatype, int root,
 #undef FUNCNAME
 #define FUNCNAME MPI_Bcast
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 
 /*@
 MPI_Bcast - Broadcasts a message from the process with rank "root" to
@@ -1530,7 +1530,7 @@ int MPI_Bcast( void *buffer, int count, MPI_Datatype datatype, int root,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_BCAST);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -1589,7 +1589,7 @@ int MPI_Bcast( void *buffer, int count, MPI_Datatype datatype, int root,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_BCAST);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/exscan.c b/src/mpi/coll/exscan.c
index 6cf6b52..cf9ad79 100644
--- a/src/mpi/coll/exscan.c
+++ b/src/mpi/coll/exscan.c
@@ -83,7 +83,7 @@ int MPI_Exscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
 #undef FUNCNAME
 #define FUNCNAME MPIR_Exscan
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Exscan ( 
     const void *sendbuf,
     void *recvbuf,
@@ -141,7 +141,7 @@ int MPIR_Exscan (
 
     mpi_errno = MPIR_Localcopy((sendbuf == MPI_IN_PLACE ? (const void *)recvbuf : sendbuf), count, datatype,
                                partial_scan, count, datatype);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* check if multiple threads are calling this collective function */
     MPIDU_ERR_CHECK_MULTIPLE_THREADS_ENTER( comm_ptr );
@@ -160,14 +160,14 @@ int MPIR_Exscan (
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
 
             if (rank > dst) {
 		mpi_errno = MPIR_Reduce_local_impl( tmp_buf, partial_scan,
 						    count, datatype, op );
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
                 /* On rank 0, recvbuf is not defined.  For sendbuf==MPI_IN_PLACE
                    recvbuf must not change (per MPI-2.2).
@@ -180,14 +180,14 @@ int MPIR_Exscan (
                         /* simply copy data recd from rank 0 into recvbuf */
                         mpi_errno = MPIR_Localcopy(tmp_buf, count, datatype,
                                                    recvbuf, count, datatype);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
                         flag = 1;
                     }
                     else {
 			mpi_errno = MPIR_Reduce_local_impl( tmp_buf,
 					    recvbuf, count, datatype, op );
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     }
                 }
             }
@@ -195,17 +195,17 @@ int MPIR_Exscan (
                 if (is_commutative) {
 		    mpi_errno = MPIR_Reduce_local_impl( tmp_buf, partial_scan,
 							count, datatype, op );
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 		}
                 else {
 		    mpi_errno = MPIR_Reduce_local_impl( partial_scan,
 						tmp_buf, count, datatype, op );
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
                     mpi_errno = MPIR_Localcopy(tmp_buf, count, datatype,
                                                partial_scan,
                                                count, datatype);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 }
             }
         }
@@ -223,7 +223,7 @@ fn_exit:
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, MPI_ERR_OTHER, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, MPI_ERR_OTHER, "**coll_fail");
     return mpi_errno;
 fn_fail:
     goto fn_exit;
@@ -237,7 +237,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Exscan_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Exscan_impl(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -245,11 +245,11 @@ int MPIR_Exscan_impl(const void *sendbuf, void *recvbuf, int count, MPI_Datatype
     if (comm_ptr->coll_fns != NULL && comm_ptr->coll_fns->Exscan != NULL) {
 	/* --BEGIN USEREXTENSION-- */
 	mpi_errno = comm_ptr->coll_fns->Exscan(sendbuf, recvbuf, count, datatype, op, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	/* --END USEREXTENSION-- */
     } else {
 	mpi_errno = MPIR_Exscan(sendbuf, recvbuf, count, datatype, op, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
         
@@ -265,7 +265,7 @@ int MPIR_Exscan_impl(const void *sendbuf, void *recvbuf, int count, MPI_Datatype
 #undef FUNCNAME
 #define FUNCNAME MPI_Exscan
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 
 MPI_Exscan - Computes the exclusive scan (partial reductions) of data on a 
@@ -310,7 +310,7 @@ int MPI_Exscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_EXSCAN);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -389,7 +389,7 @@ int MPI_Exscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datat
     
   fn_exit:    
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_EXSCAN);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/gather.c b/src/mpi/coll/gather.c
index 6ee0c3b..3c6a82b 100644
--- a/src/mpi/coll/gather.c
+++ b/src/mpi/coll/gather.c
@@ -84,7 +84,7 @@ int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *
 #undef FUNCNAME
 #define FUNCNAME MPIR_Gather_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
                       int recvcount, MPI_Datatype recvtype, int root, MPID_Comm *comm_ptr,
                       MPIR_Errflag_t *errflag)
@@ -184,7 +184,7 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 	    {
 		mpi_errno = MPIR_Localcopy(sendbuf, sendcount, sendtype,
 					   ((char *) recvbuf + extent*recvcount*rank), recvcount, recvtype);
-		if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
+		if (mpi_errno) { MPIR_ERR_POP(mpi_errno); }
 	    }
         }
 	else if (tmp_buf_size && (nbytes < MPIR_CVAR_GATHER_VSMALL_MSG_SIZE))
@@ -192,7 +192,7 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
             /* copy from sendbuf into tmp_buf */
             mpi_errno = MPIR_Localcopy(sendbuf, sendcount, sendtype,
                                        tmp_buf, nbytes, MPI_BYTE);
-	    if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
+	    if (mpi_errno) { MPIR_ERR_POP(mpi_errno); }
         }
 	curr_cnt = nbytes;
         
@@ -227,8 +227,8 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                             if (mpi_errno) {
                                 /* for communication errors, just record the error but continue */
                                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                             }
 			}
 			else if (nbytes < MPIR_CVAR_GATHER_VSMALL_MSG_SIZE) {
@@ -240,8 +240,8 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                             if (mpi_errno) {
                                 /* for communication errors, just record the error but continue */
                                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                             }
 			    copy_offset = rank + mask;
 			    copy_blks = recvblks;
@@ -253,18 +253,18 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 			    displs[1] = 0;
 			    
 			    mpi_errno = MPIR_Type_indexed_impl(2, blocks, displs, recvtype, &tmp_type);
-                            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                             
 			    mpi_errno = MPIR_Type_commit_impl(&tmp_type);
-                            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 			    
 			    mpi_errno = MPIC_Recv(recvbuf, 1, tmp_type, src,
                                                      MPIR_GATHER_TAG, comm_ptr, &status, errflag);
                             if (mpi_errno) {
                                 /* for communication errors, just record the error but continue */
                                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                             }
 
 			    MPIR_Type_free_impl(&tmp_type);
@@ -291,8 +291,8 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                         if (mpi_errno) {
                             /* for communication errors, just record the error but continue */
                             *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                            MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                            MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                            MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                            MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                         }
 			curr_cnt += (recvblks * nbytes);
                     }
@@ -311,8 +311,8 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
                 }
                 else if (nbytes < MPIR_CVAR_GATHER_VSMALL_MSG_SIZE) {
@@ -321,8 +321,8 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
 		}
 		else {
@@ -340,18 +340,18 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 		    }
 		    struct_displs[1] = MPI_VOID_PTR_CAST_TO_MPI_AINT tmp_buf;
 		    mpi_errno = MPIR_Type_create_struct_impl(2, blocks, struct_displs, types, &tmp_type);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     
 		    mpi_errno = MPIR_Type_commit_impl(&tmp_type);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 		    mpi_errno = MPIC_Send(MPI_BOTTOM, 1, tmp_type, dst,
                                              MPIR_GATHER_TAG, comm_ptr, errflag);
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
 		    MPIR_Type_free_impl(&tmp_type);
 		    if (types[1] != MPI_BYTE)
@@ -370,12 +370,12 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                                        nbytes * (comm_size - copy_offset), MPI_BYTE,  
                                        ((char *) recvbuf + extent * recvcount * copy_offset),
                                        recvcount * (comm_size - copy_offset), recvtype);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	    mpi_errno = MPIR_Localcopy((char *) tmp_buf + nbytes * (comm_size - copy_offset),
                                        nbytes * (copy_blks - comm_size + copy_offset), MPI_BYTE,  
                                        recvbuf,
                                        recvcount * (copy_blks - comm_size + copy_offset), recvtype);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
 
     }
@@ -395,7 +395,7 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 	{
             mpi_errno = MPIR_Pack_impl(sendbuf, sendcount, sendtype, tmp_buf,
                                        tmp_buf_size, &position);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             nbytes = position;
         }
         else
@@ -403,7 +403,7 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
             /* do a dummy pack just to calculate nbytes */
             mpi_errno = MPIR_Pack_impl(recvbuf, 1, recvtype, tmp_buf,
                                        tmp_buf_size, &position);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             nbytes = position*recvcount;
         }
         
@@ -425,8 +425,8 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                         recv_size = 0;
                     } else
                         /* the recv size is larger than what may be sent in
@@ -444,8 +444,8 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
                 break;
             }
@@ -461,7 +461,7 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                 mpi_errno = MPIR_Unpack_impl(tmp_buf, tmp_buf_size, &position,
                                              ((char *) recvbuf + extent*recvcount*rank),
                                              recvcount*(comm_size-rank), recvtype);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             else
 	    {
@@ -469,12 +469,12 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                 mpi_errno = MPIR_Unpack_impl(tmp_buf, tmp_buf_size, &position,
                                              ((char *) recvbuf + extent*recvcount*(rank+1)),
                                              recvcount*(comm_size-rank-1), recvtype);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             if (root != 0) {
                 mpi_errno = MPIR_Unpack_impl(tmp_buf, tmp_buf_size, &position, recvbuf,
                                              recvcount*rank, recvtype);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
         }
         
@@ -488,7 +488,7 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     return mpi_errno;
  fn_fail:
     goto fn_exit;
@@ -500,7 +500,7 @@ int MPIR_Gather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 #undef FUNCNAME
 #define FUNCNAME MPIR_Gather_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Gather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
                       int recvcount, MPI_Datatype recvtype, int root, MPID_Comm *comm_ptr,
                       MPIR_Errflag_t *errflag)
@@ -560,8 +560,8 @@ int MPIR_Gather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
         else
@@ -587,7 +587,7 @@ int MPIR_Gather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
             /* all processes in remote group form new intracommunicator */
             if (!comm_ptr->local_comm) {
                 mpi_errno = MPIR_Setup_intercomm_localcomm( comm_ptr );
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
 
             newcomm_ptr = comm_ptr->local_comm;
@@ -599,8 +599,8 @@ int MPIR_Gather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
             
             if (rank == 0)
@@ -611,8 +611,8 @@ int MPIR_Gather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
             }
         }
@@ -634,8 +634,8 @@ int MPIR_Gather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
             }
         }
@@ -646,8 +646,8 @@ int MPIR_Gather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
             if (mpi_errno) {
                 /* for communication errors, just record the error but continue */
                 *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
             }
         }
     }
@@ -658,7 +658,7 @@ int MPIR_Gather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     return mpi_errno;
  fn_fail:
     goto fn_exit;
@@ -671,7 +671,7 @@ int MPIR_Gather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 #undef FUNCNAME
 #define FUNCNAME MPIR_Gather
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                 void *recvbuf, int recvcount, MPI_Datatype recvtype,
                 int root, MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
@@ -683,13 +683,13 @@ int MPIR_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
         mpi_errno = MPIR_Gather_intra(sendbuf, sendcount, sendtype,
                                       recvbuf, recvcount, recvtype, root,
                                       comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     } else {
         /* intercommunicator */
         mpi_errno = MPIR_Gather_inter(sendbuf, sendcount, sendtype,
                                       recvbuf, recvcount, recvtype, root,
                                       comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
  fn_exit:
@@ -705,7 +705,7 @@ int MPIR_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 #undef FUNCNAME
 #define FUNCNAME MPIR_Gather_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Gather_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                      void *recvbuf, int recvcount, MPI_Datatype recvtype,
                      int root, MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
@@ -717,13 +717,13 @@ int MPIR_Gather_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 	mpi_errno = comm_ptr->coll_fns->Gather(sendbuf, sendcount,
                                                sendtype, recvbuf, recvcount,
                                                recvtype, root, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	/* --END USEREXTENSION-- */
     } else {
         mpi_errno = MPIR_Gather(sendbuf, sendcount, sendtype,
                                 recvbuf, recvcount, recvtype, root,
                                 comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
  fn_exit:
@@ -738,7 +738,7 @@ int MPIR_Gather_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 #undef FUNCNAME
 #define FUNCNAME MPI_Gather
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 
 MPI_Gather - Gathers together values from a group of processes
@@ -779,7 +779,7 @@ int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_GATHER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -893,7 +893,7 @@ int MPI_Gather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_GATHER);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/gatherv.c b/src/mpi/coll/gatherv.c
index 6efca0a..eef5dd1 100644
--- a/src/mpi/coll/gatherv.c
+++ b/src/mpi/coll/gatherv.c
@@ -72,7 +72,7 @@ int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void
 #undef FUNCNAME
 #define FUNCNAME MPIR_Gatherv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Gatherv ( 
 	const void *sendbuf,
 	int sendcount,
@@ -124,7 +124,7 @@ int MPIR_Gatherv (
                         mpi_errno = MPIR_Localcopy(sendbuf, sendcount, sendtype,
                                                    ((char *)recvbuf+displs[rank]*extent), 
                                                    recvcounts[rank], recvtype);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     }
                 }
                 else {
@@ -132,13 +132,13 @@ int MPIR_Gatherv (
                                               recvcounts[i], recvtype, i,
                                               MPIR_GATHERV_TAG, comm_ptr,
                                               &reqarray[reqs++]);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 }
             }
         }
         /* ... then wait for *all* of them to finish: */
         mpi_errno = MPIC_Waitall(reqs, reqarray, starray, errflag);
-        if (mpi_errno&& mpi_errno != MPI_ERR_IN_STATUS) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno&& mpi_errno != MPI_ERR_IN_STATUS) MPIR_ERR_POP(mpi_errno);
         
         /* --BEGIN ERROR HANDLING-- */
         if (mpi_errno == MPI_ERR_IN_STATUS) {
@@ -148,8 +148,8 @@ int MPIR_Gatherv (
                     if (mpi_errno) {
                         /* for communication errors, just record the error but continue */
                         *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                        MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                        MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                        MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                        MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                     }
                 }
             }
@@ -176,8 +176,8 @@ int MPIR_Gatherv (
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
             }
             else {
@@ -186,8 +186,8 @@ int MPIR_Gatherv (
                 if (mpi_errno) {
                     /* for communication errors, just record the error but continue */
                     *errflag = MPIR_ERR_GET_CLASS(mpi_errno);
-                    MPIU_ERR_SET(mpi_errno, *errflag, "**fail");
-                    MPIU_ERR_ADD(mpi_errno_ret, mpi_errno);
+                    MPIR_ERR_SET(mpi_errno, *errflag, "**fail");
+                    MPIR_ERR_ADD(mpi_errno_ret, mpi_errno);
                 }
             }
         }
@@ -201,7 +201,7 @@ fn_exit:
     if (mpi_errno_ret)
         mpi_errno = mpi_errno_ret;
     else if (*errflag != MPIR_ERR_NONE)
-        MPIU_ERR_SET(mpi_errno, *errflag, "**coll_fail");
+        MPIR_ERR_SET(mpi_errno, *errflag, "**coll_fail");
     return mpi_errno;
 fn_fail:
     goto fn_exit;
@@ -214,7 +214,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Gatherv_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Gatherv_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                       void *recvbuf, const int *recvcounts, const int *displs, MPI_Datatype recvtype,
                       int root, MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
@@ -226,13 +226,13 @@ int MPIR_Gatherv_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 	mpi_errno = comm_ptr->coll_fns->Gatherv(sendbuf, sendcount, sendtype,
                                                 recvbuf, recvcounts, displs, recvtype,
                                                 root, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 	/* --END USEREXTENSION-- */
     } else {
         mpi_errno = MPIR_Gatherv(sendbuf, sendcount, sendtype,
                                  recvbuf, recvcounts, displs, recvtype,
                                  root, comm_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
  fn_exit:
@@ -247,7 +247,7 @@ int MPIR_Gatherv_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 #undef FUNCNAME
 #define FUNCNAME MPI_Gatherv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 
 MPI_Gatherv - Gathers into specified locations from all processes in a group
@@ -292,7 +292,7 @@ int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
 
     MPIR_ERRTEST_INITIALIZED_ORDIE();
     
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_COLL_FUNC_ENTER(MPID_STATE_MPI_GATHERV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -424,7 +424,7 @@ int MPI_Gatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     
   fn_exit:
     MPID_MPI_COLL_FUNC_EXIT(MPID_STATE_MPI_GATHERV);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
   fn_fail:
diff --git a/src/mpi/coll/helper_fns.c b/src/mpi/coll/helper_fns.c
index 42808ff..7b7fb83 100644
--- a/src/mpi/coll/helper_fns.c
+++ b/src/mpi/coll/helper_fns.c
@@ -21,7 +21,7 @@
 #undef FUNCNAME
 #define FUNCNAME MPIC_Probe
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIC_Probe(int source, int tag, MPI_Comm comm, MPI_Status *status)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -71,7 +71,7 @@ int MPIR_Localcopy(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtyp
 
 #if defined(HAVE_ERROR_CHECKING)
     if (sdata_sz > rdata_sz) {
-        MPIU_ERR_SET2(mpi_errno, MPI_ERR_TRUNCATE, "**truncate", "**truncate %d %d", sdata_sz, rdata_sz);
+        MPIR_ERR_SET2(mpi_errno, MPI_ERR_TRUNCATE, "**truncate", "**truncate %d %d", sdata_sz, rdata_sz);
         copy_sz = rdata_sz;
     }
     else
@@ -94,7 +94,7 @@ int MPIR_Localcopy(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtyp
     if (sendtype_iscontig && recvtype_iscontig)
     {
 #if defined(HAVE_ERROR_CHECKING)
-        MPIU_ERR_CHKMEMCPYANDJUMP(mpi_errno,
+        MPIR_ERR_CHKMEMCPYANDJUMP(mpi_errno,
                                   ((char *)recvbuf + recvtype_true_lb),
                                   ((char *)sendbuf + sendtype_true_lb),
                                   copy_sz);
@@ -111,7 +111,7 @@ int MPIR_Localcopy(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtyp
 	MPID_Segment_init(recvbuf, recvcount, recvtype, &seg, 0);
 	last = copy_sz;
 	MPID_Segment_unpack(&seg, 0, &last, (char*)sendbuf + sendtype_true_lb);
-        MPIU_ERR_CHKANDJUMP(last != copy_sz, mpi_errno, MPI_ERR_TYPE, "**dtypemismatch");
+        MPIR_ERR_CHKANDJUMP(last != copy_sz, mpi_errno, MPI_ERR_TYPE, "**dtypemismatch");
     }
     else if (recvtype_iscontig)
     {
@@ -121,7 +121,7 @@ int MPIR_Localcopy(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtyp
 	MPID_Segment_init(sendbuf, sendcount, sendtype, &seg, 0);
 	last = copy_sz;
 	MPID_Segment_pack(&seg, 0, &last, (char*)recvbuf + recvtype_true_lb);
-        MPIU_ERR_CHKANDJUMP(last != copy_sz, mpi_errno, MPI_ERR_TYPE, "**dtypemismatch");
+        MPIR_ERR_CHKANDJUMP(last != copy_sz, mpi_errno, MPI_ERR_TYPE, "**dtypemismatch");
     }
     else
     {
@@ -173,7 +173,7 @@ int MPIR_Localcopy(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtyp
 	    }
 
             /* if the send side finished, but the recv side couldn't unpack it, there's a datatype mismatch */
-            MPIU_ERR_CHKANDJUMP(sfirst == copy_sz, mpi_errno, MPI_ERR_TYPE, "**dtypemismatch");        
+            MPIR_ERR_CHKANDJUMP(sfirst == copy_sz, mpi_errno, MPI_ERR_TYPE, "**dtypemismatch");        
 
             /* if not all data was unpacked, copy it to the front of the buffer for next time */
 	    buf_off = sfirst - rfirst;
@@ -223,7 +223,7 @@ int MPIC_Wait(MPID_Request * request_ptr, MPIR_Errflag_t *errflag)
         while (!MPID_Request_is_complete(request_ptr))
 	{
 	    mpi_errno = MPID_Progress_wait(&progress_state);
-	    if (mpi_errno) { MPIU_ERR_POP(mpi_errno); }
+	    if (mpi_errno) { MPIR_ERR_POP(mpi_errno); }
 	}
 	MPID_Progress_end(&progress_state);
     }
@@ -267,7 +267,7 @@ int MPIC_Wait(MPID_Request * request_ptr, MPIR_Errflag_t *errflag)
 #undef FUNCNAME
 #define FUNCNAME MPIC_Send
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIC_Send(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, int tag,
                  MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
 {
@@ -280,7 +280,7 @@ int MPIC_Send(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest,
 
     MPIU_DBG_MSG_D(PT2PT, TYPICAL, "IN: errflag = %d", *errflag);
 
-    MPIU_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
+    MPIR_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
                          "**countneg", "**countneg %d", count);
 
     switch(*errflag) {
@@ -297,10 +297,10 @@ int MPIC_Send(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest,
 
     mpi_errno = MPID_Send(buf, count, datatype, dest, tag, comm_ptr,
                           context_id, &request_ptr);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     if (request_ptr) {
         mpi_errno = MPIC_Wait(request_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_Request_release(request_ptr);
     }
 
@@ -325,7 +325,7 @@ int MPIC_Send(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest,
 #undef FUNCNAME
 #define FUNCNAME MPIC_Recv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIC_Recv(void *buf, MPI_Aint count, MPI_Datatype datatype, int source, int tag,
                  MPID_Comm *comm_ptr, MPI_Status *status, MPIR_Errflag_t *errflag)
 {
@@ -339,7 +339,7 @@ int MPIC_Recv(void *buf, MPI_Aint count, MPI_Datatype datatype, int source, int
 
     MPIU_DBG_MSG_D(PT2PT, TYPICAL, "IN: errflag = %d", *errflag);
 
-    MPIU_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
+    MPIR_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
                          "**countneg", "**countneg %d", count);
 
     context_id = (comm_ptr->comm_kind == MPID_INTRACOMM) ?
@@ -350,11 +350,11 @@ int MPIC_Recv(void *buf, MPI_Aint count, MPI_Datatype datatype, int source, int
 
     mpi_errno = MPID_Recv(buf, count, datatype, source, tag, comm_ptr,
                           context_id, status, &request_ptr);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     if (request_ptr) {
         mpi_errno = MPIC_Wait(request_ptr, errflag);
         if (mpi_errno != MPI_SUCCESS)
-            MPIU_ERR_POP(mpi_errno);
+            MPIR_ERR_POP(mpi_errno);
 
         *status = request_ptr->status;
         mpi_errno = status->MPI_ERROR;
@@ -383,7 +383,7 @@ int MPIC_Recv(void *buf, MPI_Aint count, MPI_Datatype datatype, int source, int
 #undef FUNCNAME
 #define FUNCNAME MPIC_Ssend
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIC_Ssend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest, int tag,
                   MPID_Comm *comm_ptr, MPIR_Errflag_t *errflag)
 {
@@ -396,7 +396,7 @@ int MPIC_Ssend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest,
 
     MPIU_DBG_MSG_D(PT2PT, TYPICAL, "IN: errflag = %d", *errflag);
 
-    MPIU_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
+    MPIR_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
             "**countneg", "**countneg %d", count);
 
     context_id = (comm_ptr->comm_kind == MPID_INTRACOMM) ?
@@ -413,10 +413,10 @@ int MPIC_Ssend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest,
 
     mpi_errno = MPID_Ssend(buf, count, datatype, dest, tag, comm_ptr,
                            context_id, &request_ptr);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     if (request_ptr) {
         mpi_errno = MPIC_Wait(request_ptr, errflag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_Request_release(request_ptr);
     }
 
@@ -441,7 +441,7 @@ int MPIC_Ssend(const void *buf, MPI_Aint count, MPI_Datatype datatype, int dest,
 #undef FUNCNAME
 #define FUNCNAME MPIC_Sendrecv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIC_Sendrecv(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtype,
                      int dest, int sendtag, void *recvbuf, MPI_Aint recvcount,
                      MPI_Datatype recvtype, int source, int recvtag,
@@ -457,9 +457,9 @@ int MPIC_Sendrecv(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtype
 
     MPIU_DBG_MSG_S(PT2PT, TYPICAL, "IN: errflag = %s", *errflag?"TRUE":"FALSE");
 
-    MPIU_ERR_CHKANDJUMP1((sendcount < 0), mpi_errno, MPI_ERR_COUNT,
+    MPIR_ERR_CHKANDJUMP1((sendcount < 0), mpi_errno, MPI_ERR_COUNT,
                          "**countneg", "**countneg %d", sendcount);
-    MPIU_ERR_CHKANDJUMP1((recvcount < 0), mpi_errno, MPI_ERR_COUNT,
+    MPIR_ERR_CHKANDJUMP1((recvcount < 0), mpi_errno, MPI_ERR_COUNT,
                          "**countneg", "**countneg %d", recvcount);
 
     context_id = (comm_ptr->comm_kind == MPID_INTRACOMM) ?
@@ -477,15 +477,15 @@ int MPIC_Sendrecv(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtype
 
     mpi_errno = MPID_Irecv(recvbuf, recvcount, recvtype, source, recvtag,
                            comm_ptr, context_id, &recv_req_ptr);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Isend(sendbuf, sendcount, sendtype, dest, sendtag,
                            comm_ptr, context_id, &send_req_ptr);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPIC_Wait(send_req_ptr, errflag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPIC_Wait(recv_req_ptr, errflag);
-    if (mpi_errno) MPIU_ERR_POPFATAL(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POPFATAL(mpi_errno);
 
     *status = recv_req_ptr->status;
 
@@ -519,7 +519,7 @@ int MPIC_Sendrecv(const void *sendbuf, MPI_Aint sendcount, MPI_Datatype sendtype
 #undef FUNCNAME
 #define FUNCNAME MPIC_Sendrecv_replace
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIC_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
                              int dest, int sendtag,
                              int source, int recvtag,
@@ -544,7 +544,7 @@ int MPIC_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
 
     MPIU_DBG_MSG_D(PT2PT, TYPICAL, "IN: errflag = %d", *errflag);
 
-    MPIU_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
+    MPIR_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
                          "**countneg", "**countneg %d", count);
 
     if (status == MPI_STATUS_IGNORE) status = &mystatus;
@@ -565,12 +565,12 @@ int MPIC_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
         MPIU_CHKLMEM_MALLOC(tmpbuf, void *, tmpbuf_size, mpi_errno, "temporary send buffer");
 
         mpi_errno = MPIR_Pack_impl(buf, count, datatype, tmpbuf, tmpbuf_size, &tmpbuf_count);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     mpi_errno = MPID_Irecv(buf, count, datatype, source, recvtag,
                            comm_ptr, context_id_offset, &rreq);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPID_Isend(tmpbuf, tmpbuf_count, MPI_PACKED, dest,
                            sendtag, comm_ptr, context_id_offset, &sreq);
@@ -579,14 +579,14 @@ int MPIC_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
         /* FIXME: should we cancel the pending (possibly completed) receive
          * request or wait for it to complete? */
         MPID_Request_release(rreq);
-        MPIU_ERR_POP(mpi_errno);
+        MPIR_ERR_POP(mpi_errno);
         /* --END ERROR HANDLING-- */
     }
 
     mpi_errno = MPIC_Wait(sreq, errflag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPIC_Wait(rreq, errflag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     *status = rreq->status;
 
@@ -617,7 +617,7 @@ int MPIC_Sendrecv_replace(void *buf, int count, MPI_Datatype datatype,
 #undef FUNCNAME
 #define FUNCNAME MPIC_Isend
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIC_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag,
                   MPID_Comm *comm_ptr, MPID_Request **request_ptr, MPIR_Errflag_t *errflag)
 {
@@ -629,7 +629,7 @@ int MPIC_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int
 
     MPIU_DBG_MSG_D(PT2PT, TYPICAL, "IN: errflag = %d", *errflag);
 
-    MPIU_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
+    MPIR_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
                          "**countneg", "**countneg %d", count);
 
     switch(*errflag) {
@@ -646,7 +646,7 @@ int MPIC_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int
 
     mpi_errno = MPID_Isend(buf, count, datatype, dest, tag, comm_ptr,
             context_id, request_ptr);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
  fn_exit:
     MPIDI_FUNC_EXIT(MPID_STATE_MPIC_ISEND);
@@ -658,7 +658,7 @@ int MPIC_Isend(const void *buf, int count, MPI_Datatype datatype, int dest, int
 #undef FUNCNAME
 #define FUNCNAME MPIC_Issend
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIC_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int tag,
                   MPID_Comm *comm_ptr, MPID_Request **request_ptr, MPIR_Errflag_t *errflag)
 {
@@ -670,7 +670,7 @@ int MPIC_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int
 
     MPIU_DBG_MSG_D(PT2PT, TYPICAL, "IN: errflag = %d", *errflag);
 
-    MPIU_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
+    MPIR_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
                          "**countneg", "**countneg %d", count);
 
     switch(*errflag) {
@@ -687,7 +687,7 @@ int MPIC_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int
 
     mpi_errno = MPID_Issend(buf, count, datatype, dest, tag, comm_ptr,
             context_id, request_ptr);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
  fn_exit:
     MPIDI_FUNC_EXIT(MPID_STATE_MPIC_ISSEND);
@@ -699,7 +699,7 @@ int MPIC_Issend(const void *buf, int count, MPI_Datatype datatype, int dest, int
 #undef FUNCNAME
 #define FUNCNAME MPIC_Irecv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIC_Irecv(void *buf, int count, MPI_Datatype datatype, int source,
                   int tag, MPID_Comm *comm_ptr, MPID_Request **request_ptr)
 {
@@ -709,7 +709,7 @@ int MPIC_Irecv(void *buf, int count, MPI_Datatype datatype, int source,
 
     MPIDI_FUNC_ENTER(MPID_STATE_MPIC_IRECV);
 
-    MPIU_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
+    MPIR_ERR_CHKANDJUMP1((count < 0), mpi_errno, MPI_ERR_COUNT,
                          "**countneg", "**countneg %d", count);
 
     context_id = (comm_ptr->comm_kind == MPID_INTRACOMM) ?
@@ -717,7 +717,7 @@ int MPIC_Irecv(void *buf, int count, MPI_Datatype datatype, int source,
 
     mpi_errno = MPID_Irecv(buf, count, datatype, source, tag, comm_ptr,
             context_id, request_ptr);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
  fn_exit:
     MPIDI_FUNC_EXIT(MPID_STATE_MPIC_IRECV);
@@ -730,7 +730,7 @@ int MPIC_Irecv(void *buf, int count, MPI_Datatype datatype, int source,
 #undef FUNCNAME
 #define FUNCNAME MPIC_Waitall
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIC_Waitall(int numreq, MPID_Request *requests[], MPI_Status statuses[], MPIR_Errflag_t *errflag)
 {
     int mpi_errno = MPI_SUCCESS;
diff --git a/src/mpi/coll/iallgather.c b/src/mpi/coll/iallgather.c
index c23d638..13f719c 100644
--- a/src/mpi/coll/iallgather.c
+++ b/src/mpi/coll/iallgather.c
@@ -54,7 +54,7 @@ static int dtp_release_ref(MPID_Comm *comm, int tag, void *state)
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallgather_rec_dbl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallgather_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -87,7 +87,7 @@ int MPIR_Iallgather_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype sen
         mpi_errno = MPID_Sched_copy(sendbuf, sendcount, sendtype,
                                     ((char *)recvbuf + rank*recvcount*recvtype_extent),
                                     recvcount, recvtype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -121,16 +121,16 @@ int MPIR_Iallgather_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype sen
         if (dst < comm_size) {
             mpi_errno = MPID_Sched_send_defer(((char *)recvbuf + send_offset),
                                               &ss->curr_count, recvtype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             /* send-recv, no sched barrier here */
             mpi_errno = MPID_Sched_recv_status(((char *)recvbuf + recv_offset),
                                                ((comm_size-dst_tree_root)*recvcount),
                                                recvtype, dst, comm_ptr, &ss->status, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             mpi_errno = MPID_Sched_cb(&get_count, ss, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
         }
 
@@ -187,7 +187,7 @@ int MPIR_Iallgather_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype sen
                     mpi_errno = MPID_Sched_send_defer(((char *)recvbuf + offset),
                                                       &ss->last_recv_count,
                                                       recvtype, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
                 }
                 /* recv only if this proc. doesn't have data and sender
@@ -203,7 +203,7 @@ int MPIR_Iallgather_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype sen
                                                        recvtype, dst, comm_ptr, &ss->status, s);
                     MPID_SCHED_BARRIER(s);
                     mpi_errno = MPID_Sched_cb(&get_count, ss, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
                 }
 
@@ -219,7 +219,7 @@ int MPIR_Iallgather_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype sen
 
     if (recv_dtp) {
         mpi_errno = MPID_Sched_cb(dtp_release_ref, recv_dtp, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     MPIR_SCHED_CHKPMEM_COMMIT(s);
@@ -233,7 +233,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallgather_bruck
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallgather_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -267,14 +267,14 @@ int MPIR_Iallgather_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendt
     if (sendbuf != MPI_IN_PLACE) {
         mpi_errno = MPID_Sched_copy(sendbuf, sendcount, sendtype,
                                     tmp_buf, recvcount, recvtype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
     else {
         mpi_errno = MPID_Sched_copy(((char *)recvbuf + rank * recvcount * recvtype_extent),
                                     recvcount, recvtype, tmp_buf,
                                     recvcount, recvtype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -287,11 +287,11 @@ int MPIR_Iallgather_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendt
         dst = (rank - pof2 + comm_size) % comm_size;
 
         mpi_errno = MPID_Sched_send(tmp_buf, curr_cnt, recvtype, dst, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         /* logically sendrecv, so no barrier here */
         mpi_errno = MPID_Sched_recv(((char *)tmp_buf + curr_cnt*recvtype_extent),
                                     curr_cnt, recvtype, src, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
 
         curr_cnt *= 2;
@@ -306,11 +306,11 @@ int MPIR_Iallgather_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendt
         dst = (rank - pof2 + comm_size) % comm_size;
 
         mpi_errno = MPID_Sched_send(tmp_buf, rem * recvcount, recvtype, dst, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         /* logically sendrecv, so no barrier here */
         mpi_errno = MPID_Sched_recv(((char *)tmp_buf + curr_cnt*recvtype_extent),
                                     (rem * recvcount), recvtype, src, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -320,14 +320,14 @@ int MPIR_Iallgather_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendt
     mpi_errno = MPID_Sched_copy(tmp_buf, ((comm_size-rank)*recvcount), recvtype,
                                 ((char *) recvbuf + rank*recvcount*recvtype_extent),
                                 ((comm_size-rank)*recvcount), recvtype, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     MPID_SCHED_BARRIER(s);
 
     if (rank) {
         mpi_errno = MPID_Sched_copy(((char *) tmp_buf + (comm_size-rank)*recvcount*recvtype_extent),
                                    rank*recvcount, recvtype,
                                    recvbuf, rank*recvcount, recvtype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     MPIR_SCHED_CHKPMEM_COMMIT(s);
@@ -341,7 +341,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallgather_ring
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallgather_ring(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -363,7 +363,7 @@ int MPIR_Iallgather_ring(const void *sendbuf, int sendcount, MPI_Datatype sendty
         mpi_errno = MPID_Sched_copy(sendbuf, sendcount, sendtype,
                                     ((char *)recvbuf + rank*recvcount*recvtype_extent),
                                     recvcount, recvtype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -377,11 +377,11 @@ int MPIR_Iallgather_ring(const void *sendbuf, int sendcount, MPI_Datatype sendty
     for (i=1; i<comm_size; i++) {
         mpi_errno = MPID_Sched_send(((char *)recvbuf + j*recvcount*recvtype_extent),
                                      recvcount, recvtype, right, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         /* concurrent, no barrier here */
         mpi_errno = MPID_Sched_recv(((char *)recvbuf + jnext*recvcount*recvtype_extent),
                                      recvcount, recvtype, left, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
 
         j = jnext;
@@ -442,7 +442,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallgather_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallgather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -461,19 +461,19 @@ int MPIR_Iallgather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendt
         /* Short or medium size message and power-of-two no. of processes. Use
          * recursive doubling algorithm */
         mpi_errno = MPIR_Iallgather_rec_dbl(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else if (tot_bytes < MPIR_CVAR_ALLGATHER_SHORT_MSG_SIZE) {
         /* Short message and non-power-of-two no. of processes. Use
          * Bruck algorithm (see description above). */
         mpi_errno = MPIR_Iallgather_bruck(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else {
         /* long message or medium-size message and non-power-of-two no. of
          * processes. use ring algorithm. */
         mpi_errno = MPIR_Iallgather_ring(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
 fn_exit:
@@ -485,7 +485,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallgather_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallgather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     /* Intercommunicator Allgather.
@@ -529,7 +529,7 @@ int MPIR_Iallgather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendt
         mpi_errno = newcomm_ptr->coll_fns->Igather_sched(sendbuf, sendcount, sendtype,
                                                    tmp_buf, sendcount, sendtype,
                                                    0, newcomm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -542,7 +542,7 @@ int MPIR_Iallgather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendt
             root = (rank == 0) ? MPI_ROOT : MPI_PROC_NULL;
             mpi_errno = comm_ptr->coll_fns->Ibcast_sched(tmp_buf, sendcount*local_size,
                                                    sendtype, root, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
 
         /* no sched barrier, bcasts are logically concurrent */
@@ -552,7 +552,7 @@ int MPIR_Iallgather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendt
             root = 0;
             mpi_errno = comm_ptr->coll_fns->Ibcast_sched(recvbuf, recvcount*remote_size,
                                                    recvtype, root, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         MPID_SCHED_BARRIER(s);
     }
@@ -562,7 +562,7 @@ int MPIR_Iallgather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendt
             root = 0;
             mpi_errno = comm_ptr->coll_fns->Ibcast_sched(recvbuf, recvcount*remote_size,
                                                    recvtype, root, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
 
         /* no sched barrier, bcasts are logically concurrent */
@@ -572,7 +572,7 @@ int MPIR_Iallgather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendt
             root = (rank == 0) ? MPI_ROOT : MPI_PROC_NULL;
             mpi_errno = comm_ptr->coll_fns->Ibcast_sched(tmp_buf, sendcount*local_size,
                                                    sendtype, root, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         MPID_SCHED_BARRIER(s);
     }
@@ -588,7 +588,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallgather_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallgather_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPI_Request *request)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -604,26 +604,26 @@ int MPIR_Iallgather_impl(const void *sendbuf, int sendcount, MPI_Datatype sendty
         mpi_errno = comm_ptr->coll_fns->Iallgather_req(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype,comm_ptr, &reqp);
         if (reqp) {
             *request = reqp->handle;
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             goto fn_exit;
         }
         /* --END USEREXTENSION-- */
     }
 
     mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_create(&s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIU_Assert(comm_ptr->coll_fns != NULL);
     MPIU_Assert(comm_ptr->coll_fns->Iallgather_sched != NULL);
     mpi_errno = comm_ptr->coll_fns->Iallgather_sched(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, &reqp);
     if (reqp)
         *request = reqp->handle;
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -636,7 +636,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPI_Iallgather
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Iallgather - Gathers data from all tasks and distribute the combined data
                  to all tasks in a nonblocking way
@@ -667,7 +667,7 @@ int MPI_Iallgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IALLGATHER);
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IALLGATHER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -733,13 +733,13 @@ int MPI_Iallgather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     /* ... body of routine ...  */
 
     mpi_errno = MPIR_Iallgather_impl(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm_ptr, request);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* ... end of body of routine ... */
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IALLGATHER);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/iallgatherv.c b/src/mpi/coll/iallgatherv.c
index 584ee77..2ba36c6 100644
--- a/src/mpi/coll/iallgatherv.c
+++ b/src/mpi/coll/iallgatherv.c
@@ -30,7 +30,7 @@ int MPI_Iallgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, v
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallgatherv_rec_dbl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallgatherv_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                              void *recvbuf, const int recvcounts[], const int displs[],
                              MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
@@ -80,7 +80,7 @@ int MPIR_Iallgatherv_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype se
         mpi_errno = MPID_Sched_copy(sendbuf, sendcount, sendtype,
                                    ((char *)tmp_buf + position*recvtype_extent),
                                    recvcounts[rank], recvtype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else
     {
@@ -89,7 +89,7 @@ int MPIR_Iallgatherv_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype se
                                    recvcounts[rank], recvtype,
                                    ((char *)tmp_buf + position*recvtype_extent),
                                    recvcounts[rank], recvtype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     curr_count = recvcounts[rank];
@@ -137,11 +137,11 @@ int MPIR_Iallgatherv_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype se
 
             mpi_errno = MPID_Sched_send(((char *)tmp_buf + send_offset * recvtype_extent),
                                         curr_count, recvtype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             /* sendrecv, no barrier here */
             mpi_errno = MPID_Sched_recv(((char *)tmp_buf + recv_offset * recvtype_extent),
                                         incoming_count, recvtype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             curr_count += incoming_count;
@@ -206,7 +206,7 @@ int MPIR_Iallgatherv_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype se
                        sent now. */
                     mpi_errno = MPID_Sched_send(((char *)tmp_buf + offset),
                                                 incoming_count, recvtype, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
                 }
                 /* recv only if this proc. doesn't have data and sender
@@ -229,7 +229,7 @@ int MPIR_Iallgatherv_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype se
                     mpi_errno = MPID_Sched_recv(((char *)tmp_buf + offset * recvtype_extent),
                                                 incoming_count, recvtype,
                                                 dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
                     curr_count += incoming_count;
                 }
@@ -256,7 +256,7 @@ int MPIR_Iallgatherv_rec_dbl(const void *sendbuf, int sendcount, MPI_Datatype se
                                        recvcounts[j], recvtype,
                                        ((char *)recvbuf + displs[j]*recvtype_extent),
                                        recvcounts[j], recvtype, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         position += recvcounts[j];
     }
@@ -272,7 +272,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallgatherv_bruck
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallgatherv_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                            void *recvbuf, const int recvcounts[], const int displs[],
                            MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
@@ -314,14 +314,14 @@ int MPIR_Iallgatherv_bruck(const void *sendbuf, int sendcount, MPI_Datatype send
     if (sendbuf != MPI_IN_PLACE) {
         mpi_errno = MPID_Sched_copy(sendbuf, sendcount, sendtype,
                                     tmp_buf, recvcounts[rank], recvtype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
     else {
         mpi_errno = MPID_Sched_copy(((char *)recvbuf + displs[rank]*recvtype_extent),
                                     recvcounts[rank], recvtype,
                                     tmp_buf, recvcounts[rank], recvtype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -346,11 +346,11 @@ int MPIR_Iallgatherv_bruck(const void *sendbuf, int sendcount, MPI_Datatype send
         }
 
         mpi_errno = MPID_Sched_send(tmp_buf, curr_count, recvtype, dst, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         /* sendrecv, no barrier */
         mpi_errno = MPID_Sched_recv(((char *)tmp_buf + curr_count*recvtype_extent),
                                     incoming_count, recvtype, src, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
 
         /* we will send everything we had plus what we just got to next round's dst */
@@ -369,11 +369,11 @@ int MPIR_Iallgatherv_bruck(const void *sendbuf, int sendcount, MPI_Datatype send
             send_cnt += recvcounts[(rank+i)%comm_size];
 
         mpi_errno = MPID_Sched_send(tmp_buf, send_cnt, recvtype, dst, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         /* sendrecv, no barrier */
         mpi_errno = MPID_Sched_recv(((char *)tmp_buf + curr_count*recvtype_extent),
                                      (total_count - curr_count), recvtype, src, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -387,7 +387,7 @@ int MPIR_Iallgatherv_bruck(const void *sendbuf, int sendcount, MPI_Datatype send
                                     recvcounts[j], recvtype,
                                     ((char *)recvbuf + displs[j]*recvtype_extent),
                                     recvcounts[j], recvtype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         send_cnt += recvcounts[j];
     }
 
@@ -396,7 +396,7 @@ int MPIR_Iallgatherv_bruck(const void *sendbuf, int sendcount, MPI_Datatype send
                                     recvcounts[i], recvtype,
                                     ((char *)recvbuf + displs[i]*recvtype_extent),
                                     recvcounts[i], recvtype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         send_cnt += recvcounts[i];
     }
 
@@ -411,7 +411,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallgatherv_ring
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallgatherv_ring(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                           void *recvbuf, const int recvcounts[], const int displs[],
                           MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
@@ -444,7 +444,7 @@ int MPIR_Iallgatherv_ring(const void *sendbuf, int sendcount, MPI_Datatype sendt
         mpi_errno = MPID_Sched_copy(sendbuf, sendcount, sendtype,
                                     ((char *)recvbuf + displs[rank]*recvtype_extent),
                                     recvcounts[rank], recvtype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -484,12 +484,12 @@ int MPIR_Iallgatherv_ring(const void *sendbuf, int sendcount, MPI_Datatype sendt
         /* Communicate */
         if (recvnow) { /* If there's no data to send, just do a recv call */
             mpi_errno = MPID_Sched_recv(rbuf, recvnow, recvtype, left, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             torecv -= recvnow;
         }
         if (sendnow) { /* If there's no data to receive, just do a send call */
             mpi_errno = MPID_Sched_send(sbuf, sendnow, recvtype, right, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             tosend -= sendnow;
         }
         MPID_SCHED_BARRIER(s);
@@ -553,7 +553,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallgatherv_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallgatherv_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                            void *recvbuf, const int recvcounts[], const int displs[],
                            MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
@@ -577,19 +577,19 @@ int MPIR_Iallgatherv_intra(const void *sendbuf, int sendcount, MPI_Datatype send
         /* Short or medium size message and power-of-two no. of processes. Use
          * recursive doubling algorithm */
         mpi_errno = MPIR_Iallgatherv_rec_dbl(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else if (total_count*recvtype_size < MPIR_CVAR_ALLGATHER_SHORT_MSG_SIZE) {
         /* Short message and non-power-of-two no. of processes. Use
          * Bruck algorithm (see description above). */
         mpi_errno = MPIR_Iallgatherv_bruck(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else {
         /* long message or medium-size message and non-power-of-two
          * no. of processes. Use ring algorithm. */
         mpi_errno = MPIR_Iallgatherv_ring(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
 fn_exit:
@@ -601,7 +601,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallgatherv_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallgatherv_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                            void *recvbuf, const int recvcounts[], const int displs[],
                            MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
@@ -632,13 +632,13 @@ int MPIR_Iallgatherv_inter(const void *sendbuf, int sendcount, MPI_Datatype send
         mpi_errno = comm_ptr->coll_fns->Igatherv_sched(sendbuf, sendcount, sendtype, recvbuf,
                                                  recvcounts, displs, recvtype, root,
                                                  comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         /* gatherv to right group */
         root = 0;
         mpi_errno = comm_ptr->coll_fns->Igatherv_sched(sendbuf, sendcount, sendtype, recvbuf,
                                                  recvcounts, displs, recvtype, root,
                                                  comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else {
         /* gatherv to left group  */
@@ -646,13 +646,13 @@ int MPIR_Iallgatherv_inter(const void *sendbuf, int sendcount, MPI_Datatype send
         mpi_errno = comm_ptr->coll_fns->Igatherv_sched(sendbuf, sendcount, sendtype, recvbuf,
                                                  recvcounts, displs, recvtype, root,
                                                  comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         /* gatherv from left group */
         root = (rank == 0) ? MPI_ROOT : MPI_PROC_NULL;
         mpi_errno = comm_ptr->coll_fns->Igatherv_sched(sendbuf, sendcount, sendtype, recvbuf,
                                                  recvcounts, displs, recvtype, root,
                                                  comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     MPID_SCHED_BARRIER(s);
@@ -663,20 +663,20 @@ int MPIR_Iallgatherv_inter(const void *sendbuf, int sendcount, MPI_Datatype send
     /* Get the local intracommunicator */
     if (!comm_ptr->local_comm) {
         mpi_errno = MPIR_Setup_intercomm_localcomm( comm_ptr );
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     newcomm_ptr = comm_ptr->local_comm;
     MPIU_Assert(newcomm_ptr->coll_fns && newcomm_ptr->coll_fns->Ibcast_sched);
 
     mpi_errno = MPIR_Type_indexed_impl(remote_size, recvcounts, displs, recvtype, &newtype);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPIR_Type_commit_impl(&newtype);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = newcomm_ptr->coll_fns->Ibcast_sched(recvbuf, 1, newtype, 0, newcomm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIR_Type_free_impl(&newtype);
 
@@ -689,7 +689,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallgatherv_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallgatherv_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                           void *recvbuf, const int recvcounts[], const int displs[],
                           MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPI_Request *request)
@@ -707,26 +707,26 @@ int MPIR_Iallgatherv_impl(const void *sendbuf, int sendcount, MPI_Datatype sendt
         mpi_errno = comm_ptr->coll_fns->Iallgatherv_req(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm_ptr, &reqp);
         if (reqp) {
             *request = reqp->handle;
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             goto fn_exit;
         }
         /* --END USEREXTENSION-- */
     }
 
     mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_create(&s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIU_Assert(comm_ptr->coll_fns != NULL);
     MPIU_Assert(comm_ptr->coll_fns->Iallgatherv_sched != NULL);
     mpi_errno = comm_ptr->coll_fns->Iallgatherv_sched(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, &reqp);
     if (reqp)
         *request = reqp->handle;
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -739,7 +739,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPI_Iallgatherv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Iallgatherv - Gathers data from all tasks and deliver the combined data
                   to all tasks in a nonblocking way
@@ -771,7 +771,7 @@ int MPI_Iallgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, v
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IALLGATHERV);
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IALLGATHERV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -845,13 +845,13 @@ int MPI_Iallgatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, v
     /* ... body of routine ...  */
 
     mpi_errno = MPIR_Iallgatherv_impl(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, comm_ptr, request);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* ... end of body of routine ... */
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IALLGATHERV);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/iallreduce.c b/src/mpi/coll/iallreduce.c
index 1ba3a98..d4c4d01 100644
--- a/src/mpi/coll/iallreduce.c
+++ b/src/mpi/coll/iallreduce.c
@@ -33,7 +33,7 @@ int MPI_Iallreduce(const void *sendbuf, void *recvbuf, int count, MPI_Datatype d
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallreduce_naive
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallreduce_naive(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -43,17 +43,17 @@ int MPIR_Iallreduce_naive(const void *sendbuf, void *recvbuf, int count, MPI_Dat
 
     if ((sendbuf == MPI_IN_PLACE) && (rank != 0)) {
         mpi_errno = MPIR_Ireduce_intra(recvbuf, NULL, count, datatype, op, 0, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else {
         mpi_errno = MPIR_Ireduce_intra(sendbuf, recvbuf, count, datatype, op, 0, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     MPID_SCHED_BARRIER(s);
 
     mpi_errno = MPIR_Ibcast_intra(recvbuf, count, datatype, 0, comm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -65,7 +65,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallreduce_redscat_allgather
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallreduce_redscat_allgather(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -98,7 +98,7 @@ int MPIR_Iallreduce_redscat_allgather(const void *sendbuf, void *recvbuf, int co
     if (sendbuf != MPI_IN_PLACE) {
         mpi_errno = MPID_Sched_copy(sendbuf, count, datatype,
                                     recvbuf, count, datatype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -118,7 +118,7 @@ int MPIR_Iallreduce_redscat_allgather(const void *sendbuf, void *recvbuf, int co
     if (rank < 2*rem) {
         if (rank % 2 == 0) { /* even */
             mpi_errno = MPID_Sched_send(recvbuf, count, datatype, rank+1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* temporarily set the rank to -1 so that this
@@ -128,14 +128,14 @@ int MPIR_Iallreduce_redscat_allgather(const void *sendbuf, void *recvbuf, int co
         }
         else { /* odd */
             mpi_errno = MPID_Sched_recv(tmp_buf, count, datatype, rank-1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* do the reduction on received data. since the
                ordering is right, it doesn't matter whether
                the operation is commutative or not. */
             mpi_errno = MPID_Sched_reduce(tmp_buf, recvbuf, count, datatype, op, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* change the rank */
@@ -192,11 +192,11 @@ int MPIR_Iallreduce_redscat_allgather(const void *sendbuf, void *recvbuf, int co
             /* Send data from recvbuf. Recv into tmp_buf */
             mpi_errno = MPID_Sched_recv(((char *)tmp_buf + disps[recv_idx]*extent),
                                         recv_cnt, datatype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             /* sendrecv, no barrier here */
             mpi_errno = MPID_Sched_send(((char *)recvbuf + disps[send_idx]*extent),
                                         send_cnt, datatype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* tmp_buf contains data received in this step.
@@ -207,7 +207,7 @@ int MPIR_Iallreduce_redscat_allgather(const void *sendbuf, void *recvbuf, int co
             mpi_errno = MPID_Sched_reduce(((char *)tmp_buf + disps[recv_idx]*extent),
                                           ((char *)recvbuf + disps[recv_idx]*extent),
                                           recv_cnt, datatype, op, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* update send_idx for next iteration */
@@ -251,11 +251,11 @@ int MPIR_Iallreduce_redscat_allgather(const void *sendbuf, void *recvbuf, int co
 
             mpi_errno = MPID_Sched_recv(((char *)recvbuf + disps[recv_idx]*extent),
                                         recv_cnt, datatype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             /* sendrecv, no barrier here */
             mpi_errno = MPID_Sched_send(((char *)recvbuf + disps[send_idx]*extent),
                                         send_cnt, datatype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             if (newrank > newdst) send_idx = recv_idx;
@@ -270,11 +270,11 @@ int MPIR_Iallreduce_redscat_allgather(const void *sendbuf, void *recvbuf, int co
     if (rank < 2*rem) {
         if (rank % 2) { /* odd */
             mpi_errno = MPID_Sched_send(recvbuf, count, datatype, rank-1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         else { /* even */
             mpi_errno = MPID_Sched_recv(recvbuf, count, datatype, rank+1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -290,7 +290,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallreduce_rec_dbl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallreduce_rec_dbl(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -319,7 +319,7 @@ int MPIR_Iallreduce_rec_dbl(const void *sendbuf, void *recvbuf, int count, MPI_D
     if (sendbuf != MPI_IN_PLACE) {
         mpi_errno = MPID_Sched_copy(sendbuf, count, datatype,
                                     recvbuf, count, datatype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -339,7 +339,7 @@ int MPIR_Iallreduce_rec_dbl(const void *sendbuf, void *recvbuf, int count, MPI_D
     if (rank < 2*rem) {
         if (rank % 2 == 0) { /* even */
             mpi_errno = MPID_Sched_send(recvbuf, count, datatype, rank+1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* temporarily set the rank to -1 so that this
@@ -349,14 +349,14 @@ int MPIR_Iallreduce_rec_dbl(const void *sendbuf, void *recvbuf, int count, MPI_D
         }
         else { /* odd */
             mpi_errno = MPID_Sched_recv(tmp_buf, count, datatype, rank-1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* do the reduction on received data. since the
                ordering is right, it doesn't matter whether
                the operation is commutative or not. */
             mpi_errno = MPID_Sched_reduce(tmp_buf, recvbuf, count, datatype, op, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* change the rank */
@@ -376,11 +376,11 @@ int MPIR_Iallreduce_rec_dbl(const void *sendbuf, void *recvbuf, int count, MPI_D
             /* Send the most current data, which is in recvbuf. Recv
                into tmp_buf */
             mpi_errno = MPID_Sched_recv(tmp_buf, count, datatype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             /* sendrecv, no barrier here */
             mpi_errno = MPID_Sched_send(recvbuf, count, datatype,
                                         dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* tmp_buf contains data received in this step.
@@ -389,19 +389,19 @@ int MPIR_Iallreduce_rec_dbl(const void *sendbuf, void *recvbuf, int count, MPI_D
             if (is_commutative  || (dst < rank)) {
                 /* op is commutative OR the order is already right */
                 mpi_errno = MPID_Sched_reduce(tmp_buf, recvbuf, count, datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
             }
             else {
                 /* op is noncommutative and the order is not right */
                 mpi_errno = MPID_Sched_reduce(recvbuf, tmp_buf, count, datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
 
                 /* copy result back into recvbuf */
                 mpi_errno = MPID_Sched_copy(tmp_buf, count, datatype,
                                             recvbuf, count, datatype, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
             }
             mask <<= 1;
@@ -414,11 +414,11 @@ int MPIR_Iallreduce_rec_dbl(const void *sendbuf, void *recvbuf, int count, MPI_D
     if (rank < 2*rem) {
         if (rank % 2) { /* odd */
             mpi_errno = MPID_Sched_send(recvbuf, count, datatype, rank-1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         else { /* even */
             mpi_errno = MPID_Sched_recv(recvbuf, count, datatype, rank+1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -433,7 +433,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallreduce_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallreduce_intra(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -449,7 +449,7 @@ int MPIR_Iallreduce_intra(const void *sendbuf, void *recvbuf, int count, MPI_Dat
 
     if (!is_homogeneous) {
         mpi_errno = MPIR_Iallreduce_naive(sendbuf, recvbuf, count, datatype, op, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         goto fn_exit;
     }
 
@@ -477,12 +477,12 @@ int MPIR_Iallreduce_intra(const void *sendbuf, void *recvbuf, int count, MPI_Dat
     {
         /* use recursive doubling */
         mpi_errno = MPIR_Iallreduce_rec_dbl(sendbuf, recvbuf, count, datatype, op, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else {
         /* do a reduce-scatter followed by allgather */
         mpi_errno = MPIR_Iallreduce_redscat_allgather(sendbuf, recvbuf, count, datatype, op, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
 fn_exit:
@@ -494,7 +494,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallreduce_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallreduce_inter(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
 /* Intercommunicator Allreduce.
@@ -519,43 +519,43 @@ int MPIR_Iallreduce_inter(const void *sendbuf, void *recvbuf, int count, MPI_Dat
         /* reduce from right group to rank 0*/
         root = (rank == 0) ? MPI_ROOT : MPI_PROC_NULL;
         mpi_errno = MPIR_Ireduce_inter(sendbuf, recvbuf, count, datatype, op, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         /* no barrier, these reductions can be concurrent */
 
         /* reduce to rank 0 of right group */
         root = 0;
         mpi_errno = MPIR_Ireduce_inter(sendbuf, recvbuf, count, datatype, op, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else {
         /* reduce to rank 0 of left group */
         root = 0;
         mpi_errno = MPIR_Ireduce_inter(sendbuf, recvbuf, count, datatype, op, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         /* no barrier, these reductions can be concurrent */
 
         /* reduce from right group to rank 0 */
         root = (rank == 0) ? MPI_ROOT : MPI_PROC_NULL;
         mpi_errno = MPIR_Ireduce_inter(sendbuf, recvbuf, count, datatype, op, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     /* don't bcast until the reductions have finished */
     mpi_errno = MPID_Sched_barrier(s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* Get the local intracommunicator */
     if (!comm_ptr->local_comm) {
         MPIR_Setup_intercomm_localcomm( comm_ptr );
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     lcomm_ptr = comm_ptr->local_comm;
 
     MPIU_Assert(lcomm_ptr->coll_fns && lcomm_ptr->coll_fns->Ibcast_sched);
     mpi_errno = lcomm_ptr->coll_fns->Ibcast_sched(recvbuf, count, datatype, 0, lcomm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -567,7 +567,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallreduce_SMP
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallreduce_SMP(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -588,7 +588,7 @@ int MPIR_Iallreduce_SMP(const void *sendbuf, void *recvbuf, int count, MPI_Datat
     if (!is_commutative) {
         /* use flat fallback */
         mpi_errno = MPIR_Iallreduce_intra(sendbuf, recvbuf, count, datatype, op, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         goto fn_exit;
     }
 
@@ -603,10 +603,10 @@ int MPIR_Iallreduce_SMP(const void *sendbuf, void *recvbuf, int count, MPI_Datat
             /* IN_PLACE and not root of reduce. Data supplied to this
                allreduce is in recvbuf. Pass that as the sendbuf to reduce. */
             mpi_errno = nc->coll_fns->Ireduce_sched(recvbuf, NULL, count, datatype, op, 0, nc, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         } else {
             mpi_errno = nc->coll_fns->Ireduce_sched(sendbuf, recvbuf, count, datatype, op, 0, nc, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         MPID_SCHED_BARRIER(s);
     } else {
@@ -614,7 +614,7 @@ int MPIR_Iallreduce_SMP(const void *sendbuf, void *recvbuf, int count, MPI_Datat
         if (sendbuf != MPI_IN_PLACE) {
             mpi_errno = MPID_Sched_copy(sendbuf, count, datatype,
                                         recvbuf, count, datatype, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         MPID_SCHED_BARRIER(s);
     }
@@ -623,7 +623,7 @@ int MPIR_Iallreduce_SMP(const void *sendbuf, void *recvbuf, int count, MPI_Datat
     if (nrc != NULL) {
         MPIU_Assert(nrc->coll_fns && nrc->coll_fns->Iallreduce_sched);
         mpi_errno = nrc->coll_fns->Iallreduce_sched(MPI_IN_PLACE, recvbuf, count, datatype, op, nrc, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -631,7 +631,7 @@ int MPIR_Iallreduce_SMP(const void *sendbuf, void *recvbuf, int count, MPI_Datat
     if (comm_ptr->node_comm != NULL) {
         MPIU_Assert(nc->coll_fns && nc->coll_fns->Ibcast_sched);
         mpi_errno = nc->coll_fns->Ibcast_sched(recvbuf, count, datatype, 0, nc, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -645,7 +645,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iallreduce_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iallreduce_impl(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPI_Request *request)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -661,26 +661,26 @@ int MPIR_Iallreduce_impl(const void *sendbuf, void *recvbuf, int count, MPI_Data
         mpi_errno = comm_ptr->coll_fns->Iallreduce_req(sendbuf, recvbuf, count, datatype, op, comm_ptr, &reqp);
         if (reqp) {
             *request = reqp->handle;
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             goto fn_exit;
         }
         /* --END USEREXTENSION-- */
     }
 
     mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_create(&s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIU_Assert(comm_ptr->coll_fns != NULL);
     MPIU_Assert(comm_ptr->coll_fns->Iallreduce_sched != NULL);
     mpi_errno = comm_ptr->coll_fns->Iallreduce_sched(sendbuf, recvbuf, count, datatype, op, comm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, &reqp);
     if (reqp)
         *request = reqp->handle;
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -693,7 +693,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPI_Iallreduce
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Iallreduce - Combines values from all processes and distributes the result
                  back to all processes in a nonblocking way
@@ -723,7 +723,7 @@ int MPI_Iallreduce(const void *sendbuf, void *recvbuf, int count,
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IALLREDUCE);
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IALLREDUCE);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -790,13 +790,13 @@ int MPI_Iallreduce(const void *sendbuf, void *recvbuf, int count,
     /* ... body of routine ...  */
 
     mpi_errno = MPIR_Iallreduce_impl(sendbuf, recvbuf, count, datatype, op, comm_ptr, request);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* ... end of body of routine ... */
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IALLREDUCE);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ialltoall.c b/src/mpi/coll/ialltoall.c
index 846032e..8bdd163 100644
--- a/src/mpi/coll/ialltoall.c
+++ b/src/mpi/coll/ialltoall.c
@@ -43,7 +43,7 @@ int MPI_Ialltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype, voi
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ialltoall_inplace
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ialltoall_inplace(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -84,15 +84,15 @@ int MPIR_Ialltoall_inplace(const void *sendbuf, int sendcount, MPI_Datatype send
                 mpi_errno = MPID_Sched_copy(((char *)recvbuf + peer*recvcount*recvtype_extent),
                                             recvcount, recvtype,
                                             tmp_buf, nbytes, MPI_BYTE, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
 
                 /* now simultaneously send from tmp_buf and recv to recvbuf */
                 mpi_errno = MPID_Sched_send(tmp_buf, nbytes, MPI_BYTE, peer, comm_ptr, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 mpi_errno = MPID_Sched_recv(((char *)recvbuf + peer*recvcount*recvtype_extent),
                                             recvcount, recvtype, peer, comm_ptr, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
             }
         }
@@ -109,7 +109,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ialltoall_bruck
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ialltoall_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -144,11 +144,11 @@ int MPIR_Ialltoall_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendty
     mpi_errno = MPID_Sched_copy(((char *) sendbuf + rank*sendcount*sendtype_extent),
                                 (comm_size - rank)*sendcount, sendtype,
                                 recvbuf, (comm_size - rank)*recvcount, recvtype, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_copy(sendbuf, rank*sendcount, sendtype,
                                 ((char *) recvbuf + (comm_size-rank)*recvcount*recvtype_extent),
                                 rank*recvcount, recvtype, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     MPID_SCHED_BARRIER(s);
     /* Input data is now stored in recvbuf with datatype recvtype */
 
@@ -180,22 +180,22 @@ int MPIR_Ialltoall_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendty
 
         mpi_errno = MPIR_Type_create_indexed_block_impl(count, recvcount,
                                                         displs, recvtype, &newtype);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         mpi_errno = MPIR_Type_commit_impl(&newtype);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_Datatype_get_size_macro(newtype, newtype_size);
 
         /* we will usually copy much less than nbytes */
         mpi_errno = MPID_Sched_copy(recvbuf, 1, newtype, tmp_buf, newtype_size, MPI_BYTE, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
 
         /* now send and recv in parallel */
         mpi_errno = MPID_Sched_send(tmp_buf, newtype_size, MPI_BYTE, dst, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         mpi_errno = MPID_Sched_recv(recvbuf, 1, newtype, src, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
 
         MPIR_Type_free_impl(&newtype);
@@ -218,11 +218,11 @@ int MPIR_Ialltoall_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendty
     mpi_errno = MPID_Sched_copy(((char *) recvbuf + (rank+1)*recvcount*recvtype_extent),
                                 (comm_size - rank - 1)*recvcount, recvtype,
                                 tmp_buf, (comm_size - rank - 1)*recvcount, recvtype, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_copy(recvbuf, (rank+1)*recvcount, recvtype,
                                 ((char *) tmp_buf + (comm_size-rank-1)*recvcount*recvtype_extent),
                                 (rank+1)*recvcount, recvtype, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     MPID_SCHED_BARRIER(s);
 
     /* Blocks are in the reverse order now (comm_size-1 to 0).
@@ -233,7 +233,7 @@ int MPIR_Ialltoall_bruck(const void *sendbuf, int sendcount, MPI_Datatype sendty
                                     recvcount, recvtype,
                                     ((char *) recvbuf + (comm_size-i-1)*recvcount*recvtype_extent),
                                     recvcount, recvtype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     MPIR_SCHED_CHKPMEM_COMMIT(s);
@@ -253,7 +253,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ialltoall_perm_sr
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ialltoall_perm_sr(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -280,14 +280,14 @@ int MPIR_Ialltoall_perm_sr(const void *sendbuf, int sendcount, MPI_Datatype send
             dst = (rank+i+ii) % comm_size;
             mpi_errno = MPID_Sched_recv(((char *)recvbuf + dst*recvcount*recvtype_extent),
                                         recvcount, recvtype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
 
         for (i = 0; i < ss; i++) {
             dst = (rank-i-ii+comm_size) % comm_size;
             mpi_errno = MPID_Sched_send(((char *)sendbuf + dst*sendcount*sendtype_extent),
                                         sendcount, sendtype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
 
         /* force the (2*ss) sends/recvs above to complete before posting additional ops */
@@ -306,7 +306,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ialltoall_pairwise
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ialltoall_pairwise(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -328,7 +328,7 @@ int MPIR_Ialltoall_pairwise(const void *sendbuf, int sendcount, MPI_Datatype sen
                                 sendcount, sendtype,
                                 ((char *)recvbuf + rank*recvcount*recvtype_extent),
                                 recvcount, recvtype, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     is_pof2 = MPIU_is_pof2(comm_size, NULL);
 
@@ -345,10 +345,10 @@ int MPIR_Ialltoall_pairwise(const void *sendbuf, int sendcount, MPI_Datatype sen
 
         mpi_errno = MPID_Sched_send(((char *)sendbuf + dst*sendcount*sendtype_extent),
                                     sendcount, sendtype, dst, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         mpi_errno = MPID_Sched_recv(((char *)recvbuf + src*recvcount*recvtype_extent),
                                     recvcount, recvtype, src, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -406,7 +406,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ialltoall_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ialltoall_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -419,27 +419,27 @@ int MPIR_Ialltoall_intra(const void *sendbuf, int sendcount, MPI_Datatype sendty
 
     if (sendbuf == MPI_IN_PLACE) {
         mpi_errno = MPIR_Ialltoall_inplace(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else if ((nbytes <= MPIR_CVAR_ALLTOALL_SHORT_MSG_SIZE) && (comm_size >= 8)) {
         /* use the indexing algorithm by Jehoshua Bruck et al,
          * IEEE TPDS, Nov. 97 */
         mpi_errno = MPIR_Ialltoall_bruck(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else if (nbytes <= MPIR_CVAR_ALLTOALL_MEDIUM_MSG_SIZE) {
         /* Medium-size message. Use isend/irecv with scattered
            destinations. Use Tony Ladd's modification to post only
            a small number of isends/irecvs at a time. */
         mpi_errno = MPIR_Ialltoall_perm_sr(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else {
         /* Long message. If comm_size is a power-of-two, do a pairwise
            exchange using exclusive-or to create pairs. Else send to
            rank+i, receive from rank-i. */
         mpi_errno = MPIR_Ialltoall_pairwise(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
 fn_exit:
@@ -452,7 +452,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ialltoall_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ialltoall_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
 /* Intercommunicator alltoall. We use a pairwise exchange algorithm
@@ -503,9 +503,9 @@ int MPIR_Ialltoall_inter(const void *sendbuf, int sendcount, MPI_Datatype sendty
         }
 
         mpi_errno = MPID_Sched_send(sendaddr, sendcount, sendtype, dst, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         mpi_errno = MPID_Sched_recv(recvaddr, recvcount, recvtype, src, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -518,7 +518,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ialltoall_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ialltoall_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, MPID_Comm *comm_ptr, MPI_Request *request)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -534,26 +534,26 @@ int MPIR_Ialltoall_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtyp
         mpi_errno = comm_ptr->coll_fns->Ialltoall_req(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm_ptr, &reqp);
         if (reqp) {
             *request = reqp->handle;
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             goto fn_exit;
         }
         /* --END USEREXTENSION-- */
     }
 
     mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_create(&s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIU_Assert(comm_ptr->coll_fns != NULL);
     MPIU_Assert(comm_ptr->coll_fns->Ialltoall_sched != NULL);
     mpi_errno = comm_ptr->coll_fns->Ialltoall_sched(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, &reqp);
     if (reqp)
         *request = reqp->handle;
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -566,7 +566,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPI_Ialltoall
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Ialltoall - Sends data from all to all processes in a nonblocking way
 
@@ -596,7 +596,7 @@ int MPI_Ialltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IALLTOALL);
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IALLTOALL);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -664,13 +664,13 @@ int MPI_Ialltoall(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     /* ... body of routine ...  */
 
     mpi_errno = MPIR_Ialltoall_impl(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, comm_ptr, request);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* ... end of body of routine ... */
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IALLTOALL);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ialltoallv.c b/src/mpi/coll/ialltoallv.c
index e68dfc3..97a2661 100644
--- a/src/mpi/coll/ialltoallv.c
+++ b/src/mpi/coll/ialltoallv.c
@@ -33,7 +33,7 @@ int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispl
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ialltoallv_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ialltoallv_intra(const void *sendbuf, const int sendcounts[], const int sdispls[],
                           MPI_Datatype sendtype, void *recvbuf, const int recvcounts[],
                           const int rdispls[], MPI_Datatype recvtype, MPID_Comm *comm_ptr,
@@ -93,15 +93,15 @@ int MPIR_Ialltoallv_intra(const void *sendbuf, const int sendcounts[], const int
 
                     mpi_errno = MPID_Sched_send(((char *)recvbuf + rdispls[dst]*recv_extent),
                                                 recvcounts[dst], recvtype, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     mpi_errno = MPID_Sched_recv(tmp_buf, recvcounts[dst], recvtype, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
 
                     mpi_errno = MPID_Sched_copy(tmp_buf, recvcounts[dst], recvtype,
                                                 ((char *)recvbuf + rdispls[dst]*recv_extent),
                                                 recvcounts[dst], recvtype, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
                 }
             }
@@ -130,7 +130,7 @@ int MPIR_Ialltoallv_intra(const void *sendbuf, const int sendcounts[], const int
                                                      rdispls[dst]*recv_extent);
                     mpi_errno = MPID_Sched_recv((char *)recvbuf+rdispls[dst]*recv_extent,
                                                 recvcounts[dst], recvtype, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 }
             }
 
@@ -141,7 +141,7 @@ int MPIR_Ialltoallv_intra(const void *sendbuf, const int sendcounts[], const int
                                                      sdispls[dst]*send_extent);
                     mpi_errno = MPID_Sched_send((char *)sendbuf+sdispls[dst]*send_extent,
                                                 sendcounts[dst], sendtype, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 }
             }
 
@@ -161,7 +161,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ialltoallv_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ialltoallv_inter(const void *sendbuf, const int sendcounts[], const int sdispls[],
                           MPI_Datatype sendtype, void *recvbuf, const int recvcounts[],
                           const int rdispls[], MPI_Datatype recvtype, MPID_Comm *comm_ptr,
@@ -228,11 +228,11 @@ int MPIR_Ialltoallv_inter(const void *sendbuf, const int sendcounts[], const int
             src = MPI_PROC_NULL;
 
         mpi_errno = MPID_Sched_send(sendaddr, sendcount, sendtype, dst, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         mpi_errno = MPID_Sched_recv(recvaddr, recvcount, recvtype, src, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         mpi_errno = MPID_Sched_barrier(s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
 fn_exit:
@@ -244,7 +244,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ialltoallv_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ialltoallv_impl(const void *sendbuf, const int sendcounts[], const int sdispls[],
                          MPI_Datatype sendtype, void *recvbuf, const int recvcounts[],
                          const int rdispls[], MPI_Datatype recvtype, MPID_Comm *comm_ptr,
@@ -263,26 +263,26 @@ int MPIR_Ialltoallv_impl(const void *sendbuf, const int sendcounts[], const int
         mpi_errno = comm_ptr->coll_fns->Ialltoallv_req(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm_ptr, &reqp);
         if (reqp) {
             *request = reqp->handle;
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             goto fn_exit;
         }
         /* --END USEREXTENSION-- */
     }
 
     mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_create(&s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIU_Assert(comm_ptr->coll_fns != NULL);
     MPIU_Assert(comm_ptr->coll_fns->Ialltoallv_sched != NULL);
     mpi_errno = comm_ptr->coll_fns->Ialltoallv_sched(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, &reqp);
     if (reqp)
         *request = reqp->handle;
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -295,7 +295,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPI_Ialltoallv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Ialltoallv - Sends data from all to all processes in a nonblocking way;
    each process may send a different amount of data and provide displacements
@@ -329,7 +329,7 @@ int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispl
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IALLTOALLV);
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IALLTOALLV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -399,13 +399,13 @@ int MPI_Ialltoallv(const void *sendbuf, const int sendcounts[], const int sdispl
     /* ... body of routine ...  */
 
     mpi_errno = MPIR_Ialltoallv_impl(sendbuf, sendcounts, sdispls, sendtype, recvbuf, recvcounts, rdispls, recvtype, comm_ptr, request);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* ... end of body of routine ... */
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IALLTOALLV);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ialltoallw.c b/src/mpi/coll/ialltoallw.c
index 9651b19..b42992a 100644
--- a/src/mpi/coll/ialltoallw.c
+++ b/src/mpi/coll/ialltoallw.c
@@ -54,7 +54,7 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ialltoallw_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ialltoallw_intra(const void *sendbuf, const int sendcounts[], const int sdispls[],
                           const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[],
                           const int rdispls[], const MPI_Datatype recvtypes[],
@@ -114,15 +114,15 @@ int MPIR_Ialltoallw_intra(const void *sendbuf, const int sendcounts[], const int
 
                     mpi_errno = MPID_Sched_send(((char *)recvbuf + rdispls[dst]),
                                                 recvcounts[dst], recvtypes[dst], dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     mpi_errno = MPID_Sched_recv(adj_tmp_buf, recvcounts[dst], recvtypes[dst], dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
 
                     mpi_errno = MPID_Sched_copy(adj_tmp_buf, recvcounts[dst], recvtypes[dst],
                                                 ((char *)recvbuf + rdispls[dst]),
                                                 recvcounts[dst], recvtypes[dst], s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
                 }
             }
@@ -145,7 +145,7 @@ int MPIR_Ialltoallw_intra(const void *sendbuf, const int sendcounts[], const int
                         mpi_errno = MPID_Sched_recv((char *)recvbuf+rdispls[dst],
                                                     recvcounts[dst], recvtypes[dst],
                                                     dst, comm_ptr, s);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     }
                 }
             }
@@ -158,7 +158,7 @@ int MPIR_Ialltoallw_intra(const void *sendbuf, const int sendcounts[], const int
                         mpi_errno = MPID_Sched_send((char *)sendbuf+sdispls[dst],
                                                     sendcounts[dst], sendtypes[dst],
                                                     dst, comm_ptr, s);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     }
                 }
             }
@@ -179,7 +179,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ialltoallw_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ialltoallw_inter(const void *sendbuf, const int sendcounts[], const int sdispls[],
                           const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[],
                           const int rdispls[], const MPI_Datatype recvtypes[],
@@ -233,10 +233,10 @@ int MPIR_Ialltoallw_inter(const void *sendbuf, const int sendcounts[], const int
         }
 
         mpi_errno = MPID_Sched_send(sendaddr, sendcount, sendtype, dst, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         /* sendrecv, no barrier here */
         mpi_errno = MPID_Sched_recv(recvaddr, recvcount, recvtype, src, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -249,7 +249,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ialltoallw_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ialltoallw_impl(const void *sendbuf, const int sendcounts[], const int sdispls[],
                          const MPI_Datatype sendtypes[], void *recvbuf, const int recvcounts[],
                          const int rdispls[], const MPI_Datatype recvtypes[], MPID_Comm *comm_ptr,
@@ -268,26 +268,26 @@ int MPIR_Ialltoallw_impl(const void *sendbuf, const int sendcounts[], const int
         mpi_errno = comm_ptr->coll_fns->Ialltoallw_req(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm_ptr, &reqp);
         if (reqp) {
             *request = reqp->handle;
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             goto fn_exit;
         }
         /* --END USEREXTENSION-- */
     }
 
     mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_create(&s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIU_Assert(comm_ptr->coll_fns != NULL);
     MPIU_Assert(comm_ptr->coll_fns->Ialltoallw_sched != NULL);
     mpi_errno = comm_ptr->coll_fns->Ialltoallw_sched(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, &reqp);
     if (reqp)
         *request = reqp->handle;
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -300,7 +300,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPI_Ialltoallw
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Ialltoallw - Nonblocking generalized all-to-all communication allowing
    different datatypes, counts, and displacements for each partner
@@ -334,7 +334,7 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IALLTOALLW);
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IALLTOALLW);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -375,7 +375,7 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl
             MPIR_ERRTEST_ARGNULL(rdispls,"rdispls", mpi_errno);
             MPIR_ERRTEST_ARGNULL(recvtypes,"recvtypes", mpi_errno);
             if (comm_ptr->comm_kind == MPID_INTERCOMM && sendbuf == MPI_IN_PLACE) {
-                MPIU_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**sendbuf_inplace");
+                MPIR_ERR_SETANDJUMP(mpi_errno, MPI_ERR_OTHER, "**sendbuf_inplace");
             }
             MPIR_ERRTEST_ARGNULL(request,"request", mpi_errno);
             /* TODO more checks may be appropriate (counts, in_place, etc) */
@@ -387,13 +387,13 @@ int MPI_Ialltoallw(const void *sendbuf, const int sendcounts[], const int sdispl
     /* ... body of routine ...  */
 
     mpi_errno = MPIR_Ialltoallw_impl(sendbuf, sendcounts, sdispls, sendtypes, recvbuf, recvcounts, rdispls, recvtypes, comm_ptr, request);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* ... end of body of routine ... */
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IALLTOALLW);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ibarrier.c b/src/mpi/coll/ibarrier.c
index defcb74..2176658 100644
--- a/src/mpi/coll/ibarrier.c
+++ b/src/mpi/coll/ibarrier.c
@@ -52,7 +52,7 @@ int MPI_Ibarrier(MPI_Comm comm, MPI_Request *request) __attribute__((weak,alias(
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ibarrier_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ibarrier_intra(MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -72,13 +72,13 @@ int MPIR_Ibarrier_intra(MPID_Comm *comm_ptr, MPID_Sched_t s)
         src = (rank - mask + size) % size;
 
         mpi_errno = MPID_Sched_send(NULL, 0, MPI_BYTE, dst, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         mpi_errno = MPID_Sched_recv(NULL, 0, MPI_BYTE, src, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         mpi_errno = MPID_Sched_barrier(s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         mask <<= 1;
     }
@@ -95,7 +95,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ibarrier_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ibarrier_inter(MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -110,14 +110,14 @@ int MPIR_Ibarrier_inter(MPID_Comm *comm_ptr, MPID_Sched_t s)
     /* Get the local intracommunicator */
     if (!comm_ptr->local_comm) {
         mpi_errno = MPIR_Setup_intercomm_localcomm(comm_ptr);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     /* do a barrier on the local intracommunicator */
     MPIU_Assert(comm_ptr->local_comm->coll_fns && comm_ptr->local_comm->coll_fns->Ibarrier_sched);
     if(comm_ptr->local_size != 1) {
         mpi_errno = comm_ptr->local_comm->coll_fns->Ibarrier_sched(comm_ptr->local_comm, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
     /* rank 0 on each group does an intercommunicator broadcast to the
@@ -134,27 +134,27 @@ int MPIR_Ibarrier_inter(MPID_Comm *comm_ptr, MPID_Sched_t s)
     if (comm_ptr->is_low_group) {
         root = (rank == 0) ? MPI_ROOT : MPI_PROC_NULL;
         mpi_errno = comm_ptr->coll_fns->Ibcast_sched(buf, 1, MPI_BYTE, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         MPID_SCHED_BARRIER(s);
 
         /* receive bcast from right */
         root = 0;
         mpi_errno = comm_ptr->coll_fns->Ibcast_sched(buf, 1, MPI_BYTE, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else {
         /* receive bcast from left */
         root = 0;
         mpi_errno = comm_ptr->coll_fns->Ibcast_sched(buf, 1, MPI_BYTE, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         MPID_SCHED_BARRIER(s);
 
         /* bcast to left */
         root = (rank == 0) ? MPI_ROOT : MPI_PROC_NULL;
         mpi_errno = comm_ptr->coll_fns->Ibcast_sched(buf, 1, MPI_BYTE, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     MPIR_SCHED_CHKPMEM_COMMIT(s);
@@ -168,7 +168,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ibarrier_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ibarrier_impl(MPID_Comm *comm_ptr, MPI_Request *request)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -184,7 +184,7 @@ int MPIR_Ibarrier_impl(MPID_Comm *comm_ptr, MPI_Request *request)
         mpi_errno = comm_ptr->coll_fns->Ibarrier_req(comm_ptr, &reqp);
         if (reqp) {
             *request = reqp->handle;
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             goto fn_exit;
         }
         /* --END USEREXTENSION-- */
@@ -192,18 +192,18 @@ int MPIR_Ibarrier_impl(MPID_Comm *comm_ptr, MPI_Request *request)
 
     if (comm_ptr->local_size != 1 || comm_ptr->comm_kind == MPID_INTERCOMM) {
         mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         mpi_errno = MPID_Sched_create(&s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         MPIU_Assert(comm_ptr->coll_fns->Ibarrier_sched != NULL);
         mpi_errno = comm_ptr->coll_fns->Ibarrier_sched(comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, &reqp);
         if (reqp)
             *request = reqp->handle;
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
 fn_exit:
@@ -217,7 +217,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPI_Ibarrier
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Ibarrier - Notifies the process that it has reached the barrier and returns
                immediately
@@ -250,7 +250,7 @@ int MPI_Ibarrier(MPI_Comm comm, MPI_Request *request)
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IBARRIER);
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IBARRIER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -286,13 +286,13 @@ int MPI_Ibarrier(MPI_Comm comm, MPI_Request *request)
     /* ... body of routine ...  */
 
     mpi_errno = MPIR_Ibarrier_impl(comm_ptr, request);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* ... end of body of routine ... */
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IBARRIER);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ibcast.c b/src/mpi/coll/ibcast.c
index a35bcd5..ae985d3 100644
--- a/src/mpi/coll/ibcast.c
+++ b/src/mpi/coll/ibcast.c
@@ -37,7 +37,7 @@ int MPI_Ibcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Com
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ibcast_binomial
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ibcast_binomial(void *buffer, int count, MPI_Datatype datatype, int root, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -87,7 +87,7 @@ int MPIR_Ibcast_binomial(void *buffer, int count, MPI_Datatype datatype, int roo
         /* TODO: Pipeline the packing and communication */
         if (rank == root) {
             mpi_errno = MPID_Sched_copy(buffer, count, datatype, tmp_buf, nbytes, MPI_PACKED, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
         }
     }
@@ -128,7 +128,7 @@ int MPIR_Ibcast_binomial(void *buffer, int count, MPI_Datatype datatype, int roo
                 mpi_errno = MPID_Sched_recv(tmp_buf, nbytes, MPI_BYTE, src, comm_ptr, s);
             else
                 mpi_errno = MPID_Sched_recv(buffer, count, datatype, src, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
             MPID_SCHED_BARRIER(s);
 
@@ -157,7 +157,7 @@ int MPIR_Ibcast_binomial(void *buffer, int count, MPI_Datatype datatype, int roo
                 mpi_errno = MPID_Sched_send(tmp_buf, nbytes, MPI_BYTE, dst, comm_ptr, s);
             else
                 mpi_errno = MPID_Sched_send(buffer, count, datatype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
             /* NOTE: This is departure from MPIR_Bcast_binomial.  A true analog
              * would put an MPID_Sched_barrier here after every send. */
@@ -169,7 +169,7 @@ int MPIR_Ibcast_binomial(void *buffer, int count, MPI_Datatype datatype, int roo
         if (rank != root) {
             MPID_SCHED_BARRIER(s);
             mpi_errno = MPID_Sched_copy(tmp_buf, nbytes, MPI_PACKED, buffer, count, datatype, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
         }
     }
@@ -191,7 +191,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iscatter_for_bcast
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iscatter_for_bcast(void *tmp_buf, int root, MPID_Comm *comm_ptr, int nbytes, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -233,7 +233,7 @@ int MPIR_Iscatter_for_bcast(void *tmp_buf, int root, MPID_Comm *comm_ptr, int nb
             if (recv_size > 0) {
                 mpi_errno = MPID_Sched_recv(((char *)tmp_buf + relative_rank*scatter_size),
                                             recv_size, MPI_BYTE, src, comm_ptr, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
             }
             break;
@@ -258,7 +258,7 @@ int MPIR_Iscatter_for_bcast(void *tmp_buf, int root, MPID_Comm *comm_ptr, int nb
                     dst -= comm_size;
                 mpi_errno = MPID_Sched_send(((char *)tmp_buf + scatter_size*(relative_rank+mask)),
                                             send_size, MPI_BYTE, dst, comm_ptr, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
                 curr_size -= send_size;
             }
@@ -313,7 +313,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ibcast_scatter_rec_dbl_allgather
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ibcast_scatter_rec_dbl_allgather(void *buffer, int count, MPI_Datatype datatype, int root, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -368,14 +368,14 @@ int MPIR_Ibcast_scatter_rec_dbl_allgather(void *buffer, int count, MPI_Datatype
         if (rank == root) {
             mpi_errno = MPID_Sched_copy(buffer, count, datatype,
                                         tmp_buf, nbytes, MPI_BYTE, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
         }
     }
 
 
     mpi_errno = MPIR_Iscatter_for_bcast(tmp_buf, root, comm_ptr, nbytes, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* this is the block size used for the scatter operation */
     scatter_size = (nbytes + comm_size - 1) / comm_size; /* ceiling division */
@@ -421,12 +421,12 @@ int MPIR_Ibcast_scatter_rec_dbl_allgather(void *buffer, int count, MPI_Datatype
 
             mpi_errno = MPID_Sched_send(((char *)tmp_buf + send_offset),
                                         curr_size, MPI_BYTE, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             /* sendrecv, no barrier */
             mpi_errno = MPID_Sched_recv(((char *)tmp_buf + recv_offset),
                                         incoming_count,
                                         MPI_BYTE, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             curr_size += incoming_count;
@@ -484,7 +484,7 @@ int MPIR_Ibcast_scatter_rec_dbl_allgather(void *buffer, int count, MPI_Datatype
                        sent now. */
                     mpi_errno = MPID_Sched_send(((char *)tmp_buf + offset),
                                                 incoming_count, MPI_BYTE, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
                 }
                 /* recv only if this proc. doesn't have data and sender
@@ -504,7 +504,7 @@ int MPIR_Ibcast_scatter_rec_dbl_allgather(void *buffer, int count, MPI_Datatype
                        whose data we don't have */
                     mpi_errno = MPID_Sched_recv(((char *)tmp_buf + offset),
                                                 incoming_count, MPI_BYTE, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
 
                     curr_size += incoming_count;
@@ -523,7 +523,7 @@ int MPIR_Ibcast_scatter_rec_dbl_allgather(void *buffer, int count, MPI_Datatype
         if (rank != root) {
             mpi_errno = MPID_Sched_copy(tmp_buf, nbytes, MPI_BYTE,
                                         buffer, count, datatype, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -554,7 +554,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ibcast_scatter_ring_allgather
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ibcast_scatter_ring_allgather(void *buffer, int count, MPI_Datatype datatype, int root, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -603,13 +603,13 @@ int MPIR_Ibcast_scatter_ring_allgather(void *buffer, int count, MPI_Datatype dat
         /* TODO: Pipeline the packing and communication */
         if (rank == root) {
             mpi_errno = MPID_Sched_copy(buffer, count, datatype, tmp_buf, nbytes, MPI_BYTE, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
         }
     }
 
     mpi_errno = MPIR_Iscatter_for_bcast(tmp_buf, root, comm_ptr, nbytes, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* this is the block size used for the scatter operation */
     scatter_size = (nbytes + comm_size - 1) / comm_size; /* ceiling division */
@@ -637,11 +637,11 @@ int MPIR_Ibcast_scatter_ring_allgather(void *buffer, int count, MPI_Datatype dat
 
         mpi_errno = MPID_Sched_send(((char *)tmp_buf + right_disp),
                                     right_count, MPI_BYTE, right, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         /* sendrecv, no barrier here */
         mpi_errno = MPID_Sched_recv(((char *)tmp_buf + left_disp),
                                     left_count, MPI_BYTE, left, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
 
         j     = jnext;
@@ -650,7 +650,7 @@ int MPIR_Ibcast_scatter_ring_allgather(void *buffer, int count, MPI_Datatype dat
 
     if (!is_contig && rank != root) {
         mpi_errno = MPID_Sched_copy(tmp_buf, nbytes, MPI_BYTE, buffer, count, datatype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     MPIR_SCHED_CHKPMEM_COMMIT(s);
@@ -668,7 +668,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ibcast_SMP
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ibcast_SMP(void *buffer, int count, MPI_Datatype datatype, int root, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -720,7 +720,7 @@ int MPIR_Ibcast_SMP(void *buffer, int count, MPI_Datatype datatype, int root, MP
             mpi_errno = MPID_Sched_recv(buffer, count, datatype, MPIU_Get_intranode_rank(comm_ptr, root),
                                         comm_ptr->node_comm, s);
         }
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -730,7 +730,7 @@ int MPIR_Ibcast_SMP(void *buffer, int count, MPI_Datatype datatype, int root, MP
         mpi_errno = comm_ptr->node_roots_comm->coll_fns->Ibcast_sched(buffer, count, datatype,
                                                                 MPIU_Get_internode_rank(comm_ptr, root),
                                                                 comm_ptr->node_roots_comm, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         /* don't allow the local ops for the intranode phase to start until this has completed */
         MPID_SCHED_BARRIER(s);
@@ -739,7 +739,7 @@ int MPIR_Ibcast_SMP(void *buffer, int count, MPI_Datatype datatype, int root, MP
     if (comm_ptr->node_comm != NULL)
     {
         mpi_errno = comm_ptr->node_comm->coll_fns->Ibcast_sched(buffer, count, datatype, 0, comm_ptr->node_comm, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
 fn_exit:
@@ -754,7 +754,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ibcast_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ibcast_intra(void *buffer, int count, MPI_Datatype datatype, int root, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -779,17 +779,17 @@ int MPIR_Ibcast_intra(void *buffer, int count, MPI_Datatype datatype, int root,
         (comm_size < MPIR_CVAR_BCAST_MIN_PROCS))
     {
         mpi_errno = MPIR_Ibcast_binomial(buffer, count, datatype, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else /* (nbytes >= MPIR_CVAR_BCAST_SHORT_MSG_SIZE) && (comm_size >= MPIR_CVAR_BCAST_MIN_PROCS) */
     {
         if ((nbytes < MPIR_CVAR_BCAST_LONG_MSG_SIZE) && (MPIU_is_pof2(comm_size, NULL))) {
             mpi_errno = MPIR_Ibcast_scatter_rec_dbl_allgather(buffer, count, datatype, root, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         else {
             mpi_errno = MPIR_Ibcast_scatter_ring_allgather(buffer, count, datatype, root, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -805,7 +805,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ibcast_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ibcast_inter(void *buffer, int count, MPI_Datatype datatype, int root, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -824,27 +824,27 @@ int MPIR_Ibcast_inter(void *buffer, int count, MPI_Datatype datatype, int root,
     {
         /* root sends to rank 0 on remote group and returns */
         mpi_errno = MPID_Sched_send(buffer, count, datatype, 0, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else
     {
         /* remote group. rank 0 on remote group receives from root */
         if (comm_ptr->rank == 0) {
             mpi_errno = MPID_Sched_recv(buffer, count, datatype, root, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
         }
 
         if (comm_ptr->local_comm == NULL) {
             mpi_errno = MPIR_Setup_intercomm_localcomm(comm_ptr);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
 
         /* now do the usual broadcast on this intracommunicator
            with rank 0 as root. */
         MPIU_Assert(comm_ptr->local_comm->coll_fns && comm_ptr->local_comm->coll_fns->Ibcast_sched);
         mpi_errno = comm_ptr->local_comm->coll_fns->Ibcast_sched(buffer, count, datatype, root, comm_ptr->local_comm, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
 fn_exit:
@@ -856,7 +856,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ibcast_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ibcast_impl(void *buffer, int count, MPI_Datatype datatype, int root, MPID_Comm *comm_ptr, MPI_Request *request)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -872,25 +872,25 @@ int MPIR_Ibcast_impl(void *buffer, int count, MPI_Datatype datatype, int root, M
         mpi_errno = comm_ptr->coll_fns->Ibcast_req(buffer, count, datatype, root, comm_ptr, &reqp);
         if (reqp) {
             *request = reqp->handle;
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             goto fn_exit;
         }
         /* --END USEREXTENSION-- */
     }
 
     mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_create(&s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIU_Assert(comm_ptr->coll_fns->Ibcast_sched != NULL);
     mpi_errno = comm_ptr->coll_fns->Ibcast_sched(buffer, count, datatype, root, comm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, &reqp);
     if (reqp)
         *request = reqp->handle;
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -903,7 +903,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPI_Ibcast
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Ibcast - Broadcasts a message from the process with rank "root" to
              all other processes of the communicator in a nonblocking way
@@ -932,7 +932,7 @@ int MPI_Ibcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Com
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IBCAST);
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IBCAST);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -980,13 +980,13 @@ int MPI_Ibcast(void *buffer, int count, MPI_Datatype datatype, int root, MPI_Com
     /* ... body of routine ...  */
 
     mpi_errno = MPIR_Ibcast_impl(buffer, count, datatype, root, comm_ptr, request);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* ... end of body of routine ... */
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IBCAST);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/iexscan.c b/src/mpi/coll/iexscan.c
index d5dbb3f..aca8fed 100644
--- a/src/mpi/coll/iexscan.c
+++ b/src/mpi/coll/iexscan.c
@@ -75,7 +75,7 @@ int MPI_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype data
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iexscan
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -108,7 +108,7 @@ int MPIR_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype dat
 
     mpi_errno = MPID_Sched_copy((sendbuf == MPI_IN_PLACE ? (const void *)recvbuf : sendbuf), count, datatype,
                                partial_scan, count, datatype, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     flag = 0;
     mask = 0x1;
@@ -117,15 +117,15 @@ int MPIR_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype dat
         if (dst < comm_size) {
             /* Send partial_scan to dst. Recv into tmp_buf */
             mpi_errno = MPID_Sched_send(partial_scan, count, datatype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             /* sendrecv, no barrier here */
             mpi_errno = MPID_Sched_recv(tmp_buf, count, datatype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             if (rank > dst) {
                 mpi_errno = MPID_Sched_reduce(tmp_buf, partial_scan, count, datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
 
                 /* On rank 0, recvbuf is not defined.  For sendbuf==MPI_IN_PLACE
@@ -139,14 +139,14 @@ int MPIR_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype dat
                         /* simply copy data recd from rank 0 into recvbuf */
                         mpi_errno = MPID_Sched_copy(tmp_buf, count, datatype,
                                                     recvbuf, count, datatype, s);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                         MPID_SCHED_BARRIER(s);
 
                         flag = 1;
                     }
                     else {
                         mpi_errno = MPID_Sched_reduce(tmp_buf, recvbuf, count, datatype, op, s);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                         MPID_SCHED_BARRIER(s);
                     }
                 }
@@ -154,17 +154,17 @@ int MPIR_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype dat
             else {
                 if (is_commutative) {
                     mpi_errno = MPID_Sched_reduce(tmp_buf, partial_scan, count, datatype, op, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
                 }
                 else {
                     mpi_errno = MPID_Sched_reduce(partial_scan, tmp_buf, count, datatype, op, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
 
                     mpi_errno = MPID_Sched_copy(tmp_buf, count, datatype,
                                                 partial_scan, count, datatype, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
                 }
             }
@@ -183,7 +183,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Iexscan_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Iexscan_impl(const void *sendbuf, void *recvbuf, int count, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPI_Request *request)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -199,26 +199,26 @@ int MPIR_Iexscan_impl(const void *sendbuf, void *recvbuf, int count, MPI_Datatyp
         mpi_errno = comm_ptr->coll_fns->Iexscan_req(sendbuf, recvbuf, count, datatype, op, comm_ptr, &reqp);
         if (reqp) {
             *request = reqp->handle;
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             goto fn_exit;
         }
         /* --END USEREXTENSION-- */
     }
 
     mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_create(&s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIU_Assert(comm_ptr->coll_fns != NULL);
     MPIU_Assert(comm_ptr->coll_fns->Iexscan_sched != NULL);
     mpi_errno = comm_ptr->coll_fns->Iexscan_sched(sendbuf, recvbuf, count, datatype, op, comm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, &reqp);
     if (reqp)
         *request = reqp->handle;
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -231,7 +231,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPI_Iexscan
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Iexscan - Computes the exclusive scan (partial reductions) of data on a
               collection of processes in a nonblocking way
@@ -261,7 +261,7 @@ int MPI_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype data
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IEXSCAN);
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IEXSCAN);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -321,13 +321,13 @@ int MPI_Iexscan(const void *sendbuf, void *recvbuf, int count, MPI_Datatype data
     /* ... body of routine ...  */
 
     mpi_errno = MPIR_Iexscan_impl(sendbuf, recvbuf, count, datatype, op, comm_ptr, request);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* ... end of body of routine ... */
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IEXSCAN);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/igather.c b/src/mpi/coll/igather.c
index 0b51f39..44a9af3 100644
--- a/src/mpi/coll/igather.c
+++ b/src/mpi/coll/igather.c
@@ -53,7 +53,7 @@ int MPI_Igather(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void
 #undef FUNCNAME
 #define FUNCNAME MPIR_Igather_binomial
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -136,14 +136,14 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
             if (sendbuf != MPI_IN_PLACE) {
                 mpi_errno = MPIR_Localcopy(sendbuf, sendcount, sendtype,
                                            ((char *) recvbuf + extent*recvcount*rank), recvcount, recvtype);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
         }
         else if (tmp_buf_size && (nbytes < MPIR_CVAR_GATHER_VSMALL_MSG_SIZE)) {
             /* copy from sendbuf into tmp_buf */
             mpi_errno = MPIR_Localcopy(sendbuf, sendcount, sendtype,
                                        tmp_buf, nbytes, MPI_BYTE);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         curr_cnt = nbytes;
 
@@ -168,15 +168,15 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
                              * rank 0. */
                             char *rp = (char *)recvbuf + (((rank + mask) % comm_size)*recvcount*extent);
                             mpi_errno = MPID_Sched_recv(rp, (recvblks * recvcount), recvtype, src, comm_ptr, s);
-                            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                             mpi_errno = MPID_Sched_barrier(s);
-                            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                         }
                         else if (nbytes < MPIR_CVAR_GATHER_VSMALL_MSG_SIZE) {
                             mpi_errno = MPID_Sched_recv(tmp_buf, (recvblks * nbytes), MPI_BYTE, src, comm_ptr, s);
-                            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                             mpi_errno = MPID_Sched_barrier(s);
-                            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                             copy_offset = rank + mask;
                             copy_blks = recvblks;
                         }
@@ -187,14 +187,14 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
                             displs[1] = 0;
 
                             mpi_errno = MPIR_Type_indexed_impl(2, blocks, displs, recvtype, &tmp_type);
-                            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                             mpi_errno = MPIR_Type_commit_impl(&tmp_type);
-                            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
                             mpi_errno = MPID_Sched_recv(recvbuf, 1, tmp_type, src, comm_ptr, s);
-                            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                             mpi_errno = MPID_Sched_barrier(s);
-                            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
                             /* this "premature" free is safe b/c the sched holds an actual ref to keep it alive */
                             MPIR_Type_free_impl(&tmp_type);
@@ -215,9 +215,9 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
                             offset = (mask - 1) * nbytes;
                         mpi_errno = MPID_Sched_recv(((char *)tmp_buf + offset), (recvblks * nbytes),
                                                     MPI_BYTE, src, comm_ptr, s);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                         mpi_errno = MPID_Sched_barrier(s);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                         curr_cnt += (recvblks * nbytes);
                     }
                 }
@@ -229,15 +229,15 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
                 if (!tmp_buf_size) {
                     /* leaf nodes send directly from sendbuf */
                     mpi_errno = MPID_Sched_send(sendbuf, sendcount, sendtype, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     mpi_errno = MPID_Sched_barrier(s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 }
                 else if (nbytes < MPIR_CVAR_GATHER_VSMALL_MSG_SIZE) {
                     mpi_errno = MPID_Sched_send(tmp_buf, curr_cnt, MPI_BYTE, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     mpi_errno = MPID_Sched_barrier(s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 }
                 else {
                     blocks[0] = sendcount;
@@ -248,12 +248,12 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
                     types[1] = MPI_BYTE;
 
                     mpi_errno = MPIR_Type_create_struct_impl(2, blocks, struct_displs, types, &tmp_type);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     mpi_errno = MPIR_Type_commit_impl(&tmp_type);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
                     mpi_errno = MPID_Sched_send(MPI_BOTTOM, 1, tmp_type, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
 
                     /* this "premature" free is safe b/c the sched holds an actual ref to keep it alive */
@@ -271,12 +271,12 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
             mpi_errno = MPID_Sched_copy(tmp_buf, nbytes * (comm_size - copy_offset), MPI_BYTE,
                                        ((char *)recvbuf + extent * recvcount * copy_offset),
                                        recvcount * (comm_size - copy_offset), recvtype, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             mpi_errno = MPID_Sched_copy((char *)tmp_buf + nbytes * (comm_size - copy_offset),
                                         nbytes * (copy_blks - comm_size + copy_offset), MPI_BYTE,
                                         recvbuf, recvcount * (copy_blks - comm_size + copy_offset),
                                         recvtype, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 #ifdef MPID_HAS_HETERO
@@ -298,14 +298,14 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
         if (sendbuf != MPI_IN_PLACE) {
             mpi_errno = MPIR_Pack_impl(sendbuf, sendcount, sendtype, tmp_buf,
                                        tmp_buf_size, &position);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             nbytes = position;
         }
         else {
             /* do a dummy pack just to calculate nbytes */
             mpi_errno = MPIR_Pack_impl(recvbuf, 1, recvtype, tmp_buf,
                                        tmp_buf_size, &position);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             nbytes = position*recvcount;
         }
 
@@ -334,7 +334,7 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
                 dst = (dst + root) % comm_size;
                 mpi_errno = MPIC_Send(tmp_buf, curr_cnt, MPI_BYTE, dst,
                                          MPIR_GATHER_TAG, comm_ptr, errflag);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 break;
             }
             mask <<= 1;
@@ -348,19 +348,19 @@ int MPIR_Igather_binomial(const void *sendbuf, int sendcount, MPI_Datatype sendt
                 mpi_errno = MPIR_Unpack_impl(tmp_buf, tmp_buf_size, &position,
                                              ((char *) recvbuf + extent*recvcount*rank),
                                              recvcount*(comm_size-rank), recvtype);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             else {
                 position = nbytes;
                 mpi_errno = MPIR_Unpack_impl(tmp_buf, tmp_buf_size, &position,
                                              ((char *) recvbuf + extent*recvcount*(rank+1)),
                                              recvcount*(comm_size-rank-1), recvtype);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             if (root != 0) {
                 mpi_errno = MPIR_Unpack_impl(tmp_buf, tmp_buf_size, &position, recvbuf,
                                              recvcount*rank, recvtype);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
         }
 
@@ -379,13 +379,13 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Igather_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Igather_intra(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
 
     mpi_errno = MPIR_Igather_binomial(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -396,7 +396,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Igather_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Igather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -440,7 +440,7 @@ int MPIR_Igather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype
         if (root == MPI_ROOT) {
             /* root receives data from rank 0 on remote group */
             mpi_errno = MPID_Sched_recv(recvbuf, recvcount*remote_size, recvtype, 0, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         else {
             /* remote group. Rank 0 allocates temporary buffer, does
@@ -463,7 +463,7 @@ int MPIR_Igather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype
             /* all processes in remote group form new intracommunicator */
             if (!comm_ptr->local_comm) {
                 mpi_errno = MPIR_Setup_intercomm_localcomm( comm_ptr );
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
 
             newcomm_ptr = comm_ptr->local_comm;
@@ -473,11 +473,11 @@ int MPIR_Igather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype
             mpi_errno = newcomm_ptr->coll_fns->Igather_sched(sendbuf, sendcount, sendtype,
                                                        tmp_buf, sendcount, sendtype, 0,
                                                        newcomm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
             if (rank == 0) {
                 mpi_errno = MPID_Sched_send(tmp_buf, sendcount*local_size, sendtype, root, comm_ptr, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
         }
     }
@@ -491,12 +491,12 @@ int MPIR_Igather_inter(const void *sendbuf, int sendcount, MPI_Datatype sendtype
             for (i=0; i<remote_size; i++) {
                 mpi_errno = MPID_Sched_recv(((char *)recvbuf+recvcount*i*extent),
                                             recvcount, recvtype, i, comm_ptr, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
         }
         else {
             mpi_errno = MPID_Sched_send(sendbuf, sendcount, sendtype, root, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -511,7 +511,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Igather_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Igather_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf, int recvcount, MPI_Datatype recvtype, int root, MPID_Comm *comm_ptr, MPI_Request *request)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -529,26 +529,26 @@ int MPIR_Igather_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
                                                           root, comm_ptr, &reqp);
         if (reqp) {
             *request = reqp->handle;
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             goto fn_exit;
         }
         /* --END USEREXTENSION-- */
     }
 
     mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_create(&s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIU_Assert(comm_ptr->coll_fns != NULL);
     MPIU_Assert(comm_ptr->coll_fns->Igather_sched != NULL);
     mpi_errno = comm_ptr->coll_fns->Igather_sched(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, &reqp);
     if (reqp)
         *request = reqp->handle;
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -561,7 +561,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPI_Igather
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Igather - Gathers together values from a group of processes in
               a nonblocking way
@@ -593,7 +593,7 @@ int MPI_Igather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IGATHER);
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IGATHER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -709,13 +709,13 @@ int MPI_Igather(const void *sendbuf, int sendcount, MPI_Datatype sendtype,
     /* ... body of routine ...  */
 
     mpi_errno = MPIR_Igather_impl(sendbuf, sendcount, sendtype, recvbuf, recvcount, recvtype, root, comm_ptr, request);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* ... end of body of routine ... */
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IGATHER);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/igatherv.c b/src/mpi/coll/igatherv.c
index 7f64179..faf3579 100644
--- a/src/mpi/coll/igatherv.c
+++ b/src/mpi/coll/igatherv.c
@@ -32,7 +32,7 @@ int MPI_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void
 #undef FUNCNAME
 #define FUNCNAME MPIR_Igatherv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
                   const int recvcounts[], const int displs[], MPI_Datatype recvtype, int root,
                   MPID_Comm *comm_ptr, MPID_Sched_t s)
@@ -65,13 +65,13 @@ int MPIR_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, voi
                         mpi_errno = MPID_Sched_copy(sendbuf, sendcount, sendtype,
                                                     ((char *)recvbuf+displs[rank]*extent),
                                                     recvcounts[rank], recvtype, s);
-                        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     }
                 }
                 else {
                     mpi_errno = MPID_Sched_recv(((char *)recvbuf+displs[i]*extent),
                                                 recvcounts[i], recvtype, i, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 }
             }
         }
@@ -95,7 +95,7 @@ int MPIR_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, voi
                 mpi_errno = MPID_Sched_ssend(sendbuf, sendcount, sendtype, root, comm_ptr, s);
             else
                 mpi_errno = MPID_Sched_send(sendbuf, sendcount, sendtype, root, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -108,7 +108,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Igatherv_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Igatherv_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void *recvbuf,
                        const int recvcounts[], const int displs[], MPI_Datatype recvtype,
                        int root, MPID_Comm *comm_ptr, MPI_Request *request)
@@ -128,26 +128,26 @@ int MPIR_Igatherv_impl(const void *sendbuf, int sendcount, MPI_Datatype sendtype
                                                            root, comm_ptr, &reqp);
         if (reqp) {
             *request = reqp->handle;
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             goto fn_exit;
         }
         /* --END USEREXTENSION-- */
     }
 
     mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_create(&s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIU_Assert(comm_ptr->coll_fns != NULL);
     MPIU_Assert(comm_ptr->coll_fns->Igatherv_sched != NULL);
     mpi_errno = comm_ptr->coll_fns->Igatherv_sched(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, &reqp);
     if (reqp)
         *request = reqp->handle;
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -160,7 +160,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPI_Igatherv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Igatherv - Gathers into specified locations from all processes in a group
                in a nonblocking way
@@ -193,7 +193,7 @@ int MPI_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void
     MPID_Comm *comm_ptr = NULL;
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IGATHERV);
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IGATHERV);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -319,13 +319,13 @@ int MPI_Igatherv(const void *sendbuf, int sendcount, MPI_Datatype sendtype, void
     /* ... body of routine ...  */
 
     mpi_errno = MPIR_Igatherv_impl(sendbuf, sendcount, sendtype, recvbuf, recvcounts, displs, recvtype, root, comm_ptr, request);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* ... end of body of routine ... */
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IGATHERV);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ired_scat.c b/src/mpi/coll/ired_scat.c
index 741e758..916d325 100644
--- a/src/mpi/coll/ired_scat.c
+++ b/src/mpi/coll/ired_scat.c
@@ -34,7 +34,7 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ireduce_scatter_rec_hlv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ireduce_scatter_rec_hlv(const void *sendbuf, void *recvbuf, const int recvcounts[],
                                  MPI_Datatype datatype, MPI_Op op,
                                  MPID_Comm *comm_ptr, MPID_Sched_t s)
@@ -91,7 +91,7 @@ int MPIR_Ireduce_scatter_rec_hlv(const void *sendbuf, void *recvbuf, const int r
     else
         mpi_errno = MPID_Sched_copy(recvbuf, total_count, datatype,
                                     tmp_results, total_count, datatype, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     MPID_SCHED_BARRIER(s);
 
     pof2 = 1;
@@ -109,7 +109,7 @@ int MPIR_Ireduce_scatter_rec_hlv(const void *sendbuf, void *recvbuf, const int r
     if (rank < 2*rem) {
         if (rank % 2 == 0) { /* even */
             mpi_errno = MPID_Sched_send(tmp_results, total_count, datatype, rank+1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* temporarily set the rank to -1 so that this
@@ -119,14 +119,14 @@ int MPIR_Ireduce_scatter_rec_hlv(const void *sendbuf, void *recvbuf, const int r
         }
         else { /* odd */
             mpi_errno = MPID_Sched_recv(tmp_recvbuf, total_count, datatype, rank-1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* do the reduction on received data. since the
                ordering is right, it doesn't matter whether
                the operation is commutative or not. */
             mpi_errno = MPID_Sched_reduce(tmp_recvbuf, tmp_results, total_count, datatype, op, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* change the rank */
@@ -193,10 +193,10 @@ int MPIR_Ireduce_scatter_rec_hlv(const void *sendbuf, void *recvbuf, const int r
 
                 mpi_errno = MPID_Sched_send(((char *)tmp_results + newdisps[send_idx]*extent),
                                             send_cnt, datatype, send_dst, comm_ptr, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 mpi_errno = MPID_Sched_recv(((char *) tmp_recvbuf + newdisps[recv_idx]*extent),
                                             recv_cnt, datatype, recv_dst, comm_ptr, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
             }
 
@@ -220,7 +220,7 @@ int MPIR_Ireduce_scatter_rec_hlv(const void *sendbuf, void *recvbuf, const int r
             mpi_errno = MPID_Sched_copy(((char *)tmp_results + disps[rank]*extent),
                                         recvcounts[rank], datatype,
                                         recvbuf, recvcounts[rank], datatype, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
         }
 
@@ -234,14 +234,14 @@ int MPIR_Ireduce_scatter_rec_hlv(const void *sendbuf, void *recvbuf, const int r
             if (recvcounts[rank-1]) {
                 mpi_errno = MPID_Sched_send(((char *)tmp_results + disps[rank-1]*extent),
                                             recvcounts[rank-1], datatype, rank-1, comm_ptr, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
             }
         }
         else  {   /* even */
             if (recvcounts[rank]) {
                 mpi_errno = MPID_Sched_recv(recvbuf, recvcounts[rank], datatype, rank+1, comm_ptr, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
             }
         }
@@ -261,7 +261,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ireduce_scatter_rec_pairwise
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ireduce_scatter_pairwise(const void *sendbuf, void *recvbuf, const int recvcounts[],
                                   MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr,
                                   MPID_Sched_t s)
@@ -305,7 +305,7 @@ int MPIR_Ireduce_scatter_pairwise(const void *sendbuf, void *recvbuf, const int
         mpi_errno = MPID_Sched_copy(((char *)sendbuf+disps[rank]*extent),
                                     recvcounts[rank], datatype,
                                     recvbuf, recvcounts[rank], datatype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -323,15 +323,15 @@ int MPIR_Ireduce_scatter_pairwise(const void *sendbuf, void *recvbuf, const int
         if (sendbuf != MPI_IN_PLACE) {
             mpi_errno = MPID_Sched_send(((char *)sendbuf+disps[dst]*extent),
                                         recvcounts[dst], datatype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         else {
             mpi_errno = MPID_Sched_send(((char *)recvbuf+disps[dst]*extent),
                                         recvcounts[dst], datatype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         mpi_errno = MPID_Sched_recv(tmp_recvbuf, recvcounts[rank], datatype, src, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
 
         /* FIXME does this algorithm actually work correctly for noncommutative ops?
@@ -339,12 +339,12 @@ int MPIR_Ireduce_scatter_pairwise(const void *sendbuf, void *recvbuf, const int
         if (is_commutative || (src < rank)) {
             if (sendbuf != MPI_IN_PLACE) {
                 mpi_errno = MPID_Sched_reduce(tmp_recvbuf, recvbuf, recvcounts[rank], datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             else {
                 mpi_errno = MPID_Sched_reduce(tmp_recvbuf, ((char *)recvbuf+disps[rank]*extent),
                                               recvcounts[rank], datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 /* We can't store the result at the beginning of
                    recvbuf right here because there is useful data there that
                    other process/processes need.  At the end we will copy back
@@ -355,23 +355,23 @@ int MPIR_Ireduce_scatter_pairwise(const void *sendbuf, void *recvbuf, const int
         else {
             if (sendbuf != MPI_IN_PLACE) {
                 mpi_errno = MPID_Sched_reduce(recvbuf, tmp_recvbuf, recvcounts[rank], datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
                 /* copy result back into recvbuf */
                 mpi_errno = MPID_Sched_copy(tmp_recvbuf, recvcounts[rank], datatype,
                                             recvbuf, recvcounts[rank], datatype, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             else {
                 mpi_errno = MPID_Sched_reduce(((char *)recvbuf+disps[rank]*extent),
                                               tmp_recvbuf, recvcounts[rank], datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
                 /* copy result back into recvbuf */
                 mpi_errno = MPID_Sched_copy(tmp_recvbuf, recvcounts[rank], datatype,
                                             ((char *)recvbuf + disps[rank]*extent),
                                             recvcounts[rank], datatype, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             MPID_SCHED_BARRIER(s);
         }
@@ -383,7 +383,7 @@ int MPIR_Ireduce_scatter_pairwise(const void *sendbuf, void *recvbuf, const int
         mpi_errno = MPID_Sched_copy(((char *)recvbuf + disps[rank]*extent),
                                     recvcounts[rank], datatype,
                                     recvbuf, recvcounts[rank], datatype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -400,7 +400,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ireduce_scatter_rec_dbl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ireduce_scatter_rec_dbl(const void *sendbuf, void *recvbuf, const int recvcounts[],
                                  MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr,
                                  MPID_Sched_t s)
@@ -462,7 +462,7 @@ int MPIR_Ireduce_scatter_rec_dbl(const void *sendbuf, void *recvbuf, const int r
         mpi_errno = MPID_Sched_copy(recvbuf, total_count, datatype,
                                     tmp_results, total_count, datatype, s);
 
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     MPID_SCHED_BARRIER(s);
 
     mask = 0x1;
@@ -498,10 +498,10 @@ int MPIR_Ireduce_scatter_rec_dbl(const void *sendbuf, void *recvbuf, const int r
             dis[1] += recvcounts[j];
 
         mpi_errno = MPIR_Type_indexed_impl(2, blklens, dis, datatype, &sendtype);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         mpi_errno = MPIR_Type_commit_impl(&sendtype);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         /* calculate recvtype */
         blklens[0] = blklens[1] = 0;
@@ -516,10 +516,10 @@ int MPIR_Ireduce_scatter_rec_dbl(const void *sendbuf, void *recvbuf, const int r
             dis[1] += recvcounts[j];
 
         mpi_errno = MPIR_Type_indexed_impl(2, blklens, dis, datatype, &recvtype);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         mpi_errno = MPIR_Type_commit_impl(&recvtype);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         received = 0;
         if (dst < comm_size) {
@@ -528,9 +528,9 @@ int MPIR_Ireduce_scatter_rec_dbl(const void *sendbuf, void *recvbuf, const int r
                tmp_results. accumulation is done later below.   */
 
             mpi_errno = MPID_Sched_send(tmp_results, 1, sendtype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             mpi_errno = MPID_Sched_recv(tmp_recvbuf, 1, recvtype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
             received = 1;
         }
@@ -573,7 +573,7 @@ int MPIR_Ireduce_scatter_rec_dbl(const void *sendbuf, void *recvbuf, const int r
                 {
                     /* send the current result */
                     mpi_errno = MPID_Sched_send(tmp_recvbuf, 1, recvtype, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
                 }
                 /* recv only if this proc. doesn't have data and sender
@@ -583,7 +583,7 @@ int MPIR_Ireduce_scatter_rec_dbl(const void *sendbuf, void *recvbuf, const int r
                          (rank >= tree_root + nprocs_completed))
                 {
                     mpi_errno = MPID_Sched_recv(tmp_recvbuf, 1, recvtype, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
                     received = 1;
                 }
@@ -607,26 +607,26 @@ int MPIR_Ireduce_scatter_rec_dbl(const void *sendbuf, void *recvbuf, const int r
         if (received) {
             if (is_commutative || (dst_tree_root < my_tree_root)) {
                 mpi_errno = MPID_Sched_reduce(tmp_recvbuf, tmp_results, blklens[0], datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 mpi_errno = MPID_Sched_reduce(((char *)tmp_recvbuf + dis[1]*extent),
                                               ((char *)tmp_results + dis[1]*extent),
                                               blklens[1], datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
             }
             else {
                 mpi_errno = MPID_Sched_reduce(tmp_results, tmp_recvbuf, blklens[0], datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 mpi_errno = MPID_Sched_reduce(((char *)tmp_results + dis[1]*extent),
                                               ((char *)tmp_recvbuf + dis[1]*extent),
                                               blklens[1], datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
 
                 /* copy result back into tmp_results */
                 mpi_errno = MPID_Sched_copy(tmp_recvbuf, 1, recvtype,
                                             tmp_results, 1, recvtype, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
             }
         }
@@ -642,7 +642,7 @@ int MPIR_Ireduce_scatter_rec_dbl(const void *sendbuf, void *recvbuf, const int r
     mpi_errno = MPID_Sched_copy(((char *)tmp_results+disps[rank]*extent),
                                 recvcounts[rank], datatype,
                                 recvbuf, recvcounts[rank], datatype, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     MPID_SCHED_BARRIER(s);
 
     MPIR_SCHED_CHKPMEM_COMMIT(s);
@@ -661,7 +661,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ireduce_scatter_noncomm
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 static int MPIR_Ireduce_scatter_noncomm(const void *sendbuf, void *recvbuf,
                                         const int recvcounts[], MPI_Datatype datatype, MPI_Op op,
                                         MPID_Comm *comm_ptr, MPID_Sched_t s)
@@ -715,7 +715,7 @@ static int MPIR_Ireduce_scatter_noncomm(const void *sendbuf, void *recvbuf,
                                     block_size, datatype,
                                     ((char *)tmp_buf0 + (MPIU_Mirror_permutation(i, log2_comm_size) * true_extent * block_size)),
                                     block_size, datatype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
     buf0_was_inout = 1;
@@ -741,10 +741,10 @@ static int MPIR_Ireduce_scatter_noncomm(const void *sendbuf, void *recvbuf,
 
         mpi_errno = MPID_Sched_send((outgoing_data + send_offset*true_extent),
                                     size, datatype, peer, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         mpi_errno = MPID_Sched_recv((incoming_data + recv_offset*true_extent),
                                     size, datatype, peer, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
 
         /* always perform the reduction at recv_offset, the data at send_offset
@@ -754,14 +754,14 @@ static int MPIR_Ireduce_scatter_noncomm(const void *sendbuf, void *recvbuf,
             mpi_errno = MPID_Sched_reduce((incoming_data + recv_offset*true_extent),
                                           (outgoing_data + recv_offset*true_extent),
                                           size, datatype, op, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         else {
             /* lower ranked value so need to call op(my_data, received_data) */
             mpi_errno = MPID_Sched_reduce((outgoing_data + recv_offset*true_extent),
                                           (incoming_data + recv_offset*true_extent),
                                           size, datatype, op, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             buf0_was_inout = !buf0_was_inout;
         }
         MPID_SCHED_BARRIER(s);
@@ -777,7 +777,7 @@ static int MPIR_Ireduce_scatter_noncomm(const void *sendbuf, void *recvbuf,
     result_ptr = (char *)(buf0_was_inout ? tmp_buf0 : tmp_buf1) + recv_offset * true_extent;
     mpi_errno = MPID_Sched_copy(result_ptr, size, datatype,
                                 recvbuf, size, datatype, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     MPIR_SCHED_CHKPMEM_COMMIT(s);
 fn_exit:
     return mpi_errno;
@@ -835,7 +835,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ireduce_scatter_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ireduce_scatter_intra(const void *sendbuf, void *recvbuf, const int recvcounts[],
                                MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr,
                                MPID_Sched_t s)
@@ -862,11 +862,11 @@ int MPIR_Ireduce_scatter_intra(const void *sendbuf, void *recvbuf, const int rec
     /* select an appropriate algorithm based on commutivity and message size */
     if (is_commutative && (nbytes < MPIR_CVAR_REDSCAT_COMMUTATIVE_LONG_MSG_SIZE)) {
         mpi_errno = MPIR_Ireduce_scatter_rec_hlv(sendbuf, recvbuf, recvcounts, datatype, op, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else if (is_commutative && (nbytes >= MPIR_CVAR_REDSCAT_COMMUTATIVE_LONG_MSG_SIZE)) {
         mpi_errno = MPIR_Ireduce_scatter_pairwise(sendbuf, recvbuf, recvcounts, datatype, op, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else /* (!is_commutative) */ {
         int is_block_regular = TRUE;
@@ -880,12 +880,12 @@ int MPIR_Ireduce_scatter_intra(const void *sendbuf, void *recvbuf, const int rec
         if (MPIU_is_pof2(comm_size, NULL) && is_block_regular) {
             /* noncommutative, pof2 size, and block regular */
             mpi_errno = MPIR_Ireduce_scatter_noncomm(sendbuf, recvbuf, recvcounts, datatype, op, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         else {
             /* noncommutative and (non-pof2 or block irregular), use recursive doubling. */
             mpi_errno = MPIR_Ireduce_scatter_rec_dbl(sendbuf, recvbuf, recvcounts, datatype, op, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -898,7 +898,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ireduce_scatter_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ireduce_scatter_inter(const void *sendbuf, void *recvbuf, const int recvcounts[],
                                MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr,
                                MPID_Sched_t s)
@@ -952,7 +952,7 @@ int MPIR_Ireduce_scatter_inter(const void *sendbuf, void *recvbuf, const int rec
         root = (rank == 0) ? MPI_ROOT : MPI_PROC_NULL;
         mpi_errno = comm_ptr->coll_fns->Ireduce_sched(sendbuf, tmp_buf, total_count,
                                                 datatype, op, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         /* sched barrier intentionally omitted here to allow both reductions to
          * proceed in parallel */
@@ -961,14 +961,14 @@ int MPIR_Ireduce_scatter_inter(const void *sendbuf, void *recvbuf, const int rec
         root = 0;
         mpi_errno = comm_ptr->coll_fns->Ireduce_sched(sendbuf, tmp_buf, total_count,
                                                 datatype, op, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else {
         /* reduce to rank 0 of right group */
         root = 0;
         mpi_errno = comm_ptr->coll_fns->Ireduce_sched(sendbuf, tmp_buf, total_count,
                                                 datatype, op, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         /* sched barrier intentionally omitted here to allow both reductions to
          * proceed in parallel */
@@ -977,14 +977,14 @@ int MPIR_Ireduce_scatter_inter(const void *sendbuf, void *recvbuf, const int rec
         root = (rank == 0) ? MPI_ROOT : MPI_PROC_NULL;
         mpi_errno = comm_ptr->coll_fns->Ireduce_sched(sendbuf, tmp_buf, total_count,
                                                 datatype, op, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     MPID_SCHED_BARRIER(s);
 
     /* Get the local intracommunicator */
     if (!comm_ptr->local_comm) {
         mpi_errno = MPIR_Setup_intercomm_localcomm(comm_ptr);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     newcomm_ptr = comm_ptr->local_comm;
@@ -993,7 +993,7 @@ int MPIR_Ireduce_scatter_inter(const void *sendbuf, void *recvbuf, const int rec
     mpi_errno = newcomm_ptr->coll_fns->Iscatterv_sched(tmp_buf, recvcounts, disps, datatype,
                                                  recvbuf, recvcounts[rank], datatype, 0,
                                                  newcomm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIR_SCHED_CHKPMEM_COMMIT(s);
 fn_exit:
@@ -1006,7 +1006,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ireduce_scatter_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ireduce_scatter_impl(const void *sendbuf, void *recvbuf, const int recvcounts[],
                               MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr,
                               MPI_Request *request)
@@ -1026,26 +1026,26 @@ int MPIR_Ireduce_scatter_impl(const void *sendbuf, void *recvbuf, const int recv
                                                                   comm_ptr, &reqp);
         if (reqp) {
             *request = reqp->handle;
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             goto fn_exit;
         }
         /* --END USEREXTENSION-- */
     }
 
     mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_create(&s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIU_Assert(comm_ptr->coll_fns != NULL);
     MPIU_Assert(comm_ptr->coll_fns->Ireduce_scatter_sched != NULL);
     mpi_errno = comm_ptr->coll_fns->Ireduce_scatter_sched(sendbuf, recvbuf, recvcounts, datatype, op, comm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     mpi_errno = MPID_Sched_start(&s, comm_ptr, tag, &reqp);
     if (reqp)
         *request = reqp->handle;
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
 fn_exit:
     return mpi_errno;
@@ -1058,7 +1058,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPI_Ireduce_scatter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 /*@
 MPI_Ireduce_scatter - Combines values and scatters the results in
                       a nonblocking way
@@ -1089,7 +1089,7 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts
     MPID_MPI_STATE_DECL(MPID_STATE_MPI_IREDUCE_SCATTER);
     i = 0;
 
-    MPIU_THREAD_CS_ENTER(ALLFUNC,);
+    MPID_THREAD_CS_ENTER(GLOBAL, MPIR_ThreadInfo.global_mutex);
     MPID_MPI_FUNC_ENTER(MPID_STATE_MPI_IREDUCE_SCATTER);
 
     /* Validate parameters, especially handles needing to be converted */
@@ -1153,13 +1153,13 @@ int MPI_Ireduce_scatter(const void *sendbuf, void *recvbuf, const int recvcounts
     /* ... body of routine ...  */
 
     mpi_errno = MPIR_Ireduce_scatter_impl(sendbuf, recvbuf, recvcounts, datatype, op, comm_ptr, request);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     /* ... end of body of routine ... */
 
 fn_exit:
     MPID_MPI_FUNC_EXIT(MPID_STATE_MPI_IREDUCE_SCATTER);
-    MPIU_THREAD_CS_EXIT(ALLFUNC,);
+    MPID_THREAD_CS_EXIT(GLOBAL, MPIR_ThreadInfo.global_mutex);
     return mpi_errno;
 
 fn_fail:
diff --git a/src/mpi/coll/ired_scat_block.c b/src/mpi/coll/ired_scat_block.c
index 17042c2..8df4092 100644
--- a/src/mpi/coll/ired_scat_block.c
+++ b/src/mpi/coll/ired_scat_block.c
@@ -35,7 +35,7 @@ int MPI_Ireduce_scatter_block(const void *sendbuf, void *recvbuf, int recvcount,
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ireduce_scatter_block_rec_hlv
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ireduce_scatter_block_rec_hlv(const void *sendbuf, void *recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -90,7 +90,7 @@ int MPIR_Ireduce_scatter_block_rec_hlv(const void *sendbuf, void *recvbuf, int r
     else
         mpi_errno = MPID_Sched_copy(recvbuf, total_count, datatype,
                                     tmp_results, total_count, datatype, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     MPID_SCHED_BARRIER(s);
 
     pof2 = 1;
@@ -108,7 +108,7 @@ int MPIR_Ireduce_scatter_block_rec_hlv(const void *sendbuf, void *recvbuf, int r
     if (rank < 2*rem) {
         if (rank % 2 == 0) { /* even */
             mpi_errno = MPID_Sched_send(tmp_results, total_count, datatype, rank+1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* temporarily set the rank to -1 so that this
@@ -118,14 +118,14 @@ int MPIR_Ireduce_scatter_block_rec_hlv(const void *sendbuf, void *recvbuf, int r
         }
         else { /* odd */
             mpi_errno = MPID_Sched_recv(tmp_recvbuf, total_count, datatype, rank-1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* do the reduction on received data. since the
                ordering is right, it doesn't matter whether
                the operation is commutative or not. */
             mpi_errno = MPID_Sched_reduce(tmp_recvbuf, tmp_results, total_count, datatype, op, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
 
             /* change the rank */
@@ -192,10 +192,10 @@ int MPIR_Ireduce_scatter_block_rec_hlv(const void *sendbuf, void *recvbuf, int r
 
                 mpi_errno = MPID_Sched_send(((char *)tmp_results + newdisps[send_idx]*extent),
                                             send_cnt, datatype, send_dst, comm_ptr, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 mpi_errno = MPID_Sched_recv(((char *) tmp_recvbuf + newdisps[recv_idx]*extent),
                                             recv_cnt, datatype, recv_dst, comm_ptr, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
             }
 
@@ -205,7 +205,7 @@ int MPIR_Ireduce_scatter_block_rec_hlv(const void *sendbuf, void *recvbuf, int r
                 mpi_errno = MPID_Sched_reduce(((char *)tmp_recvbuf + newdisps[recv_idx]*extent),
                                               ((char *)tmp_results + newdisps[recv_idx]*extent),
                                               recv_cnt, datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
             }
 
@@ -219,7 +219,7 @@ int MPIR_Ireduce_scatter_block_rec_hlv(const void *sendbuf, void *recvbuf, int r
         mpi_errno = MPID_Sched_copy(((char *)tmp_results + disps[rank]*extent),
                                     recvcount, datatype,
                                     recvbuf, recvcount, datatype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
 
     }
@@ -231,12 +231,12 @@ int MPIR_Ireduce_scatter_block_rec_hlv(const void *sendbuf, void *recvbuf, int r
         if (rank % 2) { /* odd */
             mpi_errno = MPID_Sched_send(((char *)tmp_results + disps[rank-1]*extent),
                                         recvcount, datatype, rank-1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
         }
         else  {   /* even */
             mpi_errno = MPID_Sched_recv(recvbuf, recvcount, datatype, rank+1, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
         }
     }
@@ -255,7 +255,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ireduce_scatter_block_rec_pairwise
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ireduce_scatter_block_pairwise(const void *sendbuf, void *recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -297,7 +297,7 @@ int MPIR_Ireduce_scatter_block_pairwise(const void *sendbuf, void *recvbuf, int
         mpi_errno = MPID_Sched_copy(((char *)sendbuf+disps[rank]*extent),
                                     recvcount, datatype,
                                     recvbuf, recvcount, datatype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -315,15 +315,15 @@ int MPIR_Ireduce_scatter_block_pairwise(const void *sendbuf, void *recvbuf, int
         if (sendbuf != MPI_IN_PLACE) {
             mpi_errno = MPID_Sched_send(((char *)sendbuf+disps[dst]*extent),
                                         recvcount, datatype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         else {
             mpi_errno = MPID_Sched_send(((char *)recvbuf+disps[dst]*extent),
                                         recvcount, datatype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         mpi_errno = MPID_Sched_recv(tmp_recvbuf, recvcount, datatype, src, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
 
         /* FIXME does this algorithm actually work correctly for noncommutative ops?
@@ -331,12 +331,12 @@ int MPIR_Ireduce_scatter_block_pairwise(const void *sendbuf, void *recvbuf, int
         if (is_commutative || (src < rank)) {
             if (sendbuf != MPI_IN_PLACE) {
                 mpi_errno = MPID_Sched_reduce(tmp_recvbuf, recvbuf, recvcount, datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             else {
                 mpi_errno = MPID_Sched_reduce(tmp_recvbuf, ((char *)recvbuf+disps[rank]*extent),
                                               recvcount, datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 /* We can't store the result at the beginning of
                    recvbuf right here because there is useful data there that
                    other process/processes need.  At the end we will copy back
@@ -347,23 +347,23 @@ int MPIR_Ireduce_scatter_block_pairwise(const void *sendbuf, void *recvbuf, int
         else {
             if (sendbuf != MPI_IN_PLACE) {
                 mpi_errno = MPID_Sched_reduce(recvbuf, tmp_recvbuf, recvcount, datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
                 /* copy result back into recvbuf */
                 mpi_errno = MPID_Sched_copy(tmp_recvbuf, recvcount, datatype,
                                             recvbuf, recvcount, datatype, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             else {
                 mpi_errno = MPID_Sched_reduce(((char *)recvbuf+disps[rank]*extent),
                                               tmp_recvbuf, recvcount, datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
                 /* copy result back into recvbuf */
                 mpi_errno = MPID_Sched_copy(tmp_recvbuf, recvcount, datatype,
                                             ((char *)recvbuf + disps[rank]*extent),
                                             recvcount, datatype, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             }
             MPID_SCHED_BARRIER(s);
         }
@@ -375,7 +375,7 @@ int MPIR_Ireduce_scatter_block_pairwise(const void *sendbuf, void *recvbuf, int
         mpi_errno = MPID_Sched_copy(((char *)recvbuf + disps[rank]*extent),
                                     recvcount, datatype,
                                     recvbuf, recvcount, datatype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
     }
 
@@ -392,7 +392,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ireduce_scatter_block_rec_dbl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ireduce_scatter_block_rec_dbl(const void *sendbuf, void *recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -452,7 +452,7 @@ int MPIR_Ireduce_scatter_block_rec_dbl(const void *sendbuf, void *recvbuf, int r
         mpi_errno = MPID_Sched_copy(recvbuf, total_count, datatype,
                                     tmp_results, total_count, datatype, s);
 
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     MPID_SCHED_BARRIER(s);
 
     mask = 0x1;
@@ -485,10 +485,10 @@ int MPIR_Ireduce_scatter_block_rec_dbl(const void *sendbuf, void *recvbuf, int r
         dis[1] = blklens[0] + recvcount * (MPIR_MIN((my_tree_root + mask), comm_size) - my_tree_root);
 
         mpi_errno = MPIR_Type_indexed_impl(2, blklens, dis, datatype, &sendtype);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         mpi_errno = MPIR_Type_commit_impl(&sendtype);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         /* calculate recvtype */
         blklens[0] = recvcount * MPIR_MIN(dst_tree_root, comm_size);
@@ -501,10 +501,10 @@ int MPIR_Ireduce_scatter_block_rec_dbl(const void *sendbuf, void *recvbuf, int r
         dis[1] = blklens[0] + recvcount * (MPIR_MIN((dst_tree_root + mask), comm_size) - dst_tree_root);
 
         mpi_errno = MPIR_Type_indexed_impl(2, blklens, dis, datatype, &recvtype);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         mpi_errno = MPIR_Type_commit_impl(&recvtype);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         received = 0;
         if (dst < comm_size) {
@@ -512,9 +512,9 @@ int MPIR_Ireduce_scatter_block_rec_dbl(const void *sendbuf, void *recvbuf, int r
                received in tmp_recvbuf and then accumulated into
                tmp_results. accumulation is done later below.   */
             mpi_errno = MPID_Sched_send(tmp_results, 1, sendtype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             mpi_errno = MPID_Sched_recv(tmp_recvbuf, 1, recvtype, dst, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             MPID_SCHED_BARRIER(s);
             received = 1;
         }
@@ -557,7 +557,7 @@ int MPIR_Ireduce_scatter_block_rec_dbl(const void *sendbuf, void *recvbuf, int r
                 {
                     /* send the current result */
                     mpi_errno = MPID_Sched_send(tmp_recvbuf, 1, recvtype, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
                 }
                 /* recv only if this proc. doesn't have data and sender
@@ -567,7 +567,7 @@ int MPIR_Ireduce_scatter_block_rec_dbl(const void *sendbuf, void *recvbuf, int r
                          (rank >= tree_root + nprocs_completed))
                 {
                     mpi_errno = MPID_Sched_recv(tmp_recvbuf, 1, recvtype, dst, comm_ptr, s);
-                    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                     MPID_SCHED_BARRIER(s);
                     received = 1;
                 }
@@ -591,26 +591,26 @@ int MPIR_Ireduce_scatter_block_rec_dbl(const void *sendbuf, void *recvbuf, int r
         if (received) {
             if (is_commutative || (dst_tree_root < my_tree_root)) {
                 mpi_errno = MPID_Sched_reduce(tmp_recvbuf, tmp_results, blklens[0], datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 mpi_errno = MPID_Sched_reduce(((char *)tmp_recvbuf + dis[1]*extent),
                                               ((char *)tmp_results + dis[1]*extent),
                                               blklens[1], datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
             }
             else {
                 mpi_errno = MPID_Sched_reduce(tmp_results, tmp_recvbuf, blklens[0], datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 mpi_errno = MPID_Sched_reduce(((char *)tmp_results + dis[1]*extent),
                                               ((char *)tmp_recvbuf + dis[1]*extent),
                                               blklens[1], datatype, op, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
 
                 /* copy result back into tmp_results */
                 mpi_errno = MPID_Sched_copy(tmp_recvbuf, 1, recvtype,
                                             tmp_results, 1, recvtype, s);
-                if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+                if (mpi_errno) MPIR_ERR_POP(mpi_errno);
                 MPID_SCHED_BARRIER(s);
             }
         }
@@ -626,7 +626,7 @@ int MPIR_Ireduce_scatter_block_rec_dbl(const void *sendbuf, void *recvbuf, int r
     mpi_errno = MPID_Sched_copy(((char *)tmp_results+disps[rank]*extent),
                                 recvcount, datatype,
                                 recvbuf, recvcount, datatype, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     MPID_SCHED_BARRIER(s);
 
     MPIR_SCHED_CHKPMEM_COMMIT(s);
@@ -644,7 +644,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Reduce_scatter_block_noncomm
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ireduce_scatter_block_noncomm(const void *sendbuf, void *recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -692,7 +692,7 @@ int MPIR_Ireduce_scatter_block_noncomm(const void *sendbuf, void *recvbuf, int r
                                     block_size, datatype,
                                     ((char *)tmp_buf0 + (MPIU_Mirror_permutation(i, log2_comm_size) * true_extent * block_size)),
                                      block_size, datatype, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     MPID_SCHED_BARRIER(s);
     buf0_was_inout = 1;
@@ -718,10 +718,10 @@ int MPIR_Ireduce_scatter_block_noncomm(const void *sendbuf, void *recvbuf, int r
 
         mpi_errno = MPID_Sched_send((outgoing_data + send_offset*true_extent),
                                     size, datatype, peer, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         mpi_errno = MPID_Sched_recv((incoming_data + recv_offset*true_extent),
                                     size, datatype, peer, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         MPID_SCHED_BARRIER(s);
 
         /* always perform the reduction at recv_offset, the data at send_offset
@@ -731,14 +731,14 @@ int MPIR_Ireduce_scatter_block_noncomm(const void *sendbuf, void *recvbuf, int r
             mpi_errno = MPID_Sched_reduce((incoming_data + recv_offset*true_extent),
                                           (outgoing_data + recv_offset*true_extent),
                                           size, datatype, op, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         else {
             /* lower ranked value so need to call op(my_data, received_data) */
             mpi_errno = MPID_Sched_reduce((outgoing_data + recv_offset*true_extent),
                                           (incoming_data + recv_offset*true_extent),
                                           size, datatype, op, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             buf0_was_inout = !buf0_was_inout;
         }
         MPID_SCHED_BARRIER(s);
@@ -754,7 +754,7 @@ int MPIR_Ireduce_scatter_block_noncomm(const void *sendbuf, void *recvbuf, int r
     result_ptr = (char *)(buf0_was_inout ? tmp_buf0 : tmp_buf1) + recv_offset * true_extent;
     mpi_errno = MPID_Sched_copy(result_ptr, size, datatype,
                                 recvbuf, size, datatype, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIR_SCHED_CHKPMEM_COMMIT(s);
 fn_exit:
@@ -767,7 +767,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ireduce_scatter_block_intra
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ireduce_scatter_block_intra(const void *sendbuf, void *recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -788,22 +788,22 @@ int MPIR_Ireduce_scatter_block_intra(const void *sendbuf, void *recvbuf, int rec
     /* select an appropriate algorithm based on commutivity and message size */
     if (is_commutative && (nbytes < MPIR_CVAR_REDSCAT_COMMUTATIVE_LONG_MSG_SIZE)) {
         mpi_errno = MPIR_Ireduce_scatter_block_rec_hlv(sendbuf, recvbuf, recvcount, datatype, op, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else if (is_commutative && (nbytes >= MPIR_CVAR_REDSCAT_COMMUTATIVE_LONG_MSG_SIZE)) {
         mpi_errno = MPIR_Ireduce_scatter_block_pairwise(sendbuf, recvbuf, recvcount, datatype, op, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else /* (!is_commutative) */ {
         if (MPIU_is_pof2(comm_size, NULL)) {
             /* noncommutative, pof2 size */
             mpi_errno = MPIR_Ireduce_scatter_block_noncomm(sendbuf, recvbuf, recvcount, datatype, op, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
         else {
             /* noncommutative and non-pof2, use recursive doubling. */
             mpi_errno = MPIR_Ireduce_scatter_block_rec_dbl(sendbuf, recvbuf, recvcount, datatype, op, comm_ptr, s);
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
         }
     }
 
@@ -817,7 +817,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ireduce_scatter_block_inter
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ireduce_scatter_block_inter(const void *sendbuf, void *recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPID_Sched_t s)
 {
 /* Intercommunicator Ireduce_scatter_block.
@@ -857,7 +857,7 @@ int MPIR_Ireduce_scatter_block_inter(const void *sendbuf, void *recvbuf, int rec
         root = (rank == 0) ? MPI_ROOT : MPI_PROC_NULL;
         mpi_errno = comm_ptr->coll_fns->Ireduce_sched(sendbuf, tmp_buf, total_count,
                                                 datatype, op, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         /* sched barrier intentionally omitted here to allow both reductions to
          * proceed in parallel */
@@ -866,14 +866,14 @@ int MPIR_Ireduce_scatter_block_inter(const void *sendbuf, void *recvbuf, int rec
         root = 0;
         mpi_errno = comm_ptr->coll_fns->Ireduce_sched(sendbuf, tmp_buf, total_count,
                                                 datatype, op, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     else {
         /* reduce to rank 0 of right group */
         root = 0;
         mpi_errno = comm_ptr->coll_fns->Ireduce_sched(sendbuf, tmp_buf, total_count,
                                                 datatype, op, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
         /* sched barrier intentionally omitted here to allow both reductions to
          * proceed in parallel */
@@ -882,14 +882,14 @@ int MPIR_Ireduce_scatter_block_inter(const void *sendbuf, void *recvbuf, int rec
         root = (rank == 0) ? MPI_ROOT : MPI_PROC_NULL;
         mpi_errno = comm_ptr->coll_fns->Ireduce_sched(sendbuf, tmp_buf, total_count,
                                                 datatype, op, root, comm_ptr, s);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
     MPID_SCHED_BARRIER(s);
 
     /* Get the local intracommunicator */
     if (!comm_ptr->local_comm) {
         mpi_errno = MPIR_Setup_intercomm_localcomm(comm_ptr);
-        if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+        if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     }
 
     newcomm_ptr = comm_ptr->local_comm;
@@ -898,7 +898,7 @@ int MPIR_Ireduce_scatter_block_inter(const void *sendbuf, void *recvbuf, int rec
     mpi_errno = newcomm_ptr->coll_fns->Iscatter_sched(tmp_buf, recvcount, datatype,
                                                 recvbuf, recvcount, datatype, 0,
                                                 newcomm_ptr, s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIR_SCHED_CHKPMEM_COMMIT(s);
 fn_exit:
@@ -911,7 +911,7 @@ fn_fail:
 #undef FUNCNAME
 #define FUNCNAME MPIR_Ireduce_scatter_block_impl
 #undef FCNAME
-#define FCNAME MPIU_QUOTE(FUNCNAME)
+#define FCNAME MPL_QUOTE(FUNCNAME)
 int MPIR_Ireduce_scatter_block_impl(const void *sendbuf, void *recvbuf, int recvcount, MPI_Datatype datatype, MPI_Op op, MPID_Comm *comm_ptr, MPI_Request *request)
 {
     int mpi_errno = MPI_SUCCESS;
@@ -929,26 +929,26 @@ int MPIR_Ireduce_scatter_block_impl(const void *sendbuf, void *recvbuf, int recv
                                                                         comm_ptr, &reqp);
         if (reqp) {
             *request = reqp->handle;
-            if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+            if (mpi_errno) MPIR_ERR_POP(mpi_errno);
             goto fn_exit;
         }
         /* --END USEREXTENSION-- */
     }
 
     mpi_errno = MPID_Sched_next_tag(comm_ptr, &tag);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
     mpi_errno = MPID_Sched_create(&s);
-    if (mpi_errno) MPIU_ERR_POP(mpi_errno);
+    if (mpi_errno) MPIR_ERR_POP(mpi_errno);
 
     MPIU_Assert(comm_ptr->coll_fns != NULL);
     MPIU_Assert(comm_ptr->coll_fns->Ireduce_scatter_block_sched != NULL);
     mpi_errno = comm_ptr->coll_fns->Ireduce_scatter_block_sched(sendbuf, recvbuf, recvcount, datatyp