File tree Expand file tree Collapse file tree 4 files changed +29
-2
lines changed Expand file tree Collapse file tree 4 files changed +29
-2
lines changed Original file line number Diff line number Diff line change @@ -42,7 +42,7 @@ void mca_rcache_vma_module_init( mca_rcache_vma_module_t* rcache ) {
4242 rcache -> base .rcache_clean = mca_rcache_vma_clean ;
4343 rcache -> base .rcache_finalize = mca_rcache_vma_finalize ;
4444 rcache -> base .rcache_dump_range = mca_rcache_vma_dump_range ;
45- OBJ_CONSTRUCT (& rcache -> base .lock , opal_mutex_t );
45+ OBJ_CONSTRUCT (& rcache -> base .lock , opal_recursive_mutex_t );
4646 mca_rcache_vma_tree_init (rcache );
4747}
4848
Original file line number Diff line number Diff line change @@ -72,3 +72,29 @@ OBJ_CLASS_INSTANCE(opal_mutex_t,
7272 opal_object_t ,
7373 opal_mutex_construct ,
7474 opal_mutex_destruct );
75+
76+ static void opal_recursive_mutex_construct (opal_recursive_mutex_t * m )
77+ {
78+ pthread_mutexattr_t attr ;
79+ pthread_mutexattr_init (& attr );
80+
81+ #if OPAL_ENABLE_DEBUG
82+ m -> m_lock_debug = 0 ;
83+ m -> m_lock_file = NULL ;
84+ m -> m_lock_line = 0 ;
85+ #endif
86+
87+ pthread_mutexattr_settype (& attr , PTHREAD_MUTEX_RECURSIVE );
88+
89+ pthread_mutex_init (& m -> m_lock_pthread , & attr );
90+ pthread_mutexattr_destroy (& attr );
91+
92+ #if OPAL_HAVE_ATOMIC_SPINLOCKS
93+ opal_atomic_init ( & m -> m_lock_atomic , OPAL_ATOMIC_UNLOCKED );
94+ #endif
95+ }
96+
97+ OBJ_CLASS_INSTANCE (opal_recursive_mutex_t ,
98+ opal_object_t ,
99+ opal_recursive_mutex_construct ,
100+ opal_mutex_destruct );
Original file line number Diff line number Diff line change @@ -50,7 +50,7 @@ OPAL_DECLSPEC extern bool opal_uses_threads;
5050 * Opaque mutex object
5151 */
5252typedef struct opal_mutex_t opal_mutex_t ;
53-
53+ typedef struct opal_mutex_t opal_recursive_mutex_t ;
5454
5555/**
5656 * Try to acquire a mutex.
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ struct opal_mutex_t {
6161 opal_atomic_lock_t m_lock_atomic ;
6262};
6363OPAL_DECLSPEC OBJ_CLASS_DECLARATION (opal_mutex_t );
64+ OPAL_DECLSPEC OBJ_CLASS_DECLARATION (opal_recursive_mutex_t );
6465
6566/************************************************************************
6667 *
You can’t perform that action at this time.
0 commit comments