As requested move back the alloc and return to macros instead of static inlined functions.
This commit was SVN r8762.
Этот коммит содержится в:
родитель
d5d16c2162
Коммит
29c80875a8
@ -298,55 +298,59 @@ static inline void mca_bml_base_prepare_dst(mca_bml_base_btl_t* bml_btl,
|
||||
}
|
||||
}
|
||||
|
||||
static inline mca_btl_base_descriptor_t*
|
||||
mca_bml_base_btl_des_alloc( mca_bml_base_btl_t* bml_btl,
|
||||
size_t alloc_size,
|
||||
size_t seg_size )
|
||||
{
|
||||
mca_btl_base_descriptor_t* des;
|
||||
|
||||
if( NULL != (des = bml_btl->btl_cache) ) {
|
||||
#if OMPI_HAVE_THREAD_SUPPORT
|
||||
/* atomically acquire the cached descriptor */
|
||||
if(opal_atomic_cmpset_ptr(&bml_btl->btl_cache, des, NULL) == 0) {
|
||||
des = bml_btl->btl_alloc(bml_btl->btl, alloc_size);
|
||||
}
|
||||
#define MCA_BML_BASE_BTL_DES_ALLOC(bml_btl, des, alloc_size, seg_size) \
|
||||
do { \
|
||||
mca_btl_base_descriptor_t* des; \
|
||||
\
|
||||
if( NULL != (des = bml_btl->btl_cache) ) { \
|
||||
/* atomically acquire the cached descriptor */ \
|
||||
if(opal_atomic_cmpset_ptr(&bml_btl->btl_cache, \
|
||||
des, NULL) == 0) { \
|
||||
des = bml_btl->btl_alloc(bml_btl->btl, alloc_size); \
|
||||
} \
|
||||
} else { \
|
||||
des = bml_btl->btl_alloc(bml_btl->btl, alloc_size); \
|
||||
} \
|
||||
des->des_src->seg_len = seg_size; \
|
||||
des->des_context = (void*) bml_btl; \
|
||||
} while(0)
|
||||
#else
|
||||
bml_btl->btl_cache = NULL;
|
||||
#endif
|
||||
} else {
|
||||
des = bml_btl->btl_alloc(bml_btl->btl, alloc_size);
|
||||
}
|
||||
des->des_src->seg_len = seg_size;
|
||||
des->des_context = (void*) bml_btl;
|
||||
return des;
|
||||
}
|
||||
#define MCA_BML_BASE_BTL_DES_ALLOC(bml_btl, des, alloc_size, seg_size) \
|
||||
des = mca_bml_base_btl_des_alloc( bml_btl, alloc_size, seg_size )
|
||||
|
||||
#define MCA_BML_BASE_BTL_DES_ALLOC(bml_btl, des, alloc_size, seg_size) \
|
||||
do { \
|
||||
mca_btl_base_descriptor_t* des; \
|
||||
\
|
||||
if( NULL != (des = bml_btl->btl_cache) ) { \
|
||||
bml_btl->btl_cache = NULL; \
|
||||
} else { \
|
||||
des = bml_btl->btl_alloc(bml_btl->btl, alloc_size); \
|
||||
} \
|
||||
des->des_src->seg_len = seg_size; \
|
||||
des->des_context = (void*) bml_btl; \
|
||||
} while(0)
|
||||
#endif /* OMPI_HAVE_THREAD_SUPPORT */
|
||||
|
||||
/**
|
||||
* Return a descriptor
|
||||
*/
|
||||
|
||||
static inline void mca_bml_base_btl_des_return( mca_bml_base_btl_t* bml_btl,
|
||||
mca_btl_base_descriptor_t* des)
|
||||
{
|
||||
#if OMPI_HAVE_THREAD_SUPPORT
|
||||
if( opal_atomic_cmpset_ptr(&bml_btl->btl_cache,NULL,des) == 0 ) {
|
||||
#define MCA_BML_BASE_BTL_DES_RETURN( bml_btl, descriptor ) \
|
||||
do { \
|
||||
if( opal_atomic_cmpset_ptr(&bml_btl->btl_cache, \
|
||||
NULL,descriptor) == 0 ) { \
|
||||
bml_btl->btl_free( bml_btl->btl, descriptor ); \
|
||||
} \
|
||||
} while (0)
|
||||
#else
|
||||
if( NULL == bml_btl->btl_cache ) {
|
||||
bml_btl->btl_cache = des;
|
||||
} else {
|
||||
#endif
|
||||
bml_btl->btl_free( bml_btl->btl, des );
|
||||
}
|
||||
}
|
||||
#define MCA_BML_BASE_BTL_DES_RETURN( bml_btl, descriptor ) \
|
||||
do { \
|
||||
mca_bml_base_btl_des_return( bml_btl, descriptor ); \
|
||||
descriptor = NULL; \
|
||||
} while(0)
|
||||
do { \
|
||||
if( NULL == bml_btl->btl_cache ) { \
|
||||
bml_btl->btl_cache = descriptor; \
|
||||
} else { \
|
||||
bml_btl->btl_free( bml_btl->btl, descriptor ); \
|
||||
} \
|
||||
} while(0)
|
||||
#endif /* OMPI_HAVE_THREAD_SUPPORT */
|
||||
|
||||
/*
|
||||
* BML component interface functions and datatype.
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user