X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=src%2Fvlibapi%2Fapi_shared.c;h=aba853dc997fac91a011ed412ef8c92cef50c40d;hb=6d4af8918c8d14aa609d6488f0793152f9ed1927;hp=a553a5b5b957304119853cf4d84946d757880e99;hpb=39d69112fcec114fde34955ceb41555221d3ba11;p=vpp.git diff --git a/src/vlibapi/api_shared.c b/src/vlibapi/api_shared.c index a553a5b5b95..aba853dc997 100644 --- a/src/vlibapi/api_shared.c +++ b/src/vlibapi/api_shared.c @@ -1063,20 +1063,32 @@ vl_msg_api_get_msg_index (u8 * name_and_crc) return ~0; } +void * +vl_msg_push_heap_w_region (svm_region_t * vlib_rp) +{ + pthread_mutex_lock (&vlib_rp->mutex); + return svm_push_data_heap (vlib_rp); +} + void * vl_msg_push_heap (void) { api_main_t *am = vlibapi_get_main (); - pthread_mutex_lock (&am->vlib_rp->mutex); - return svm_push_data_heap (am->vlib_rp); + return vl_msg_push_heap_w_region (am->vlib_rp); +} + +void +vl_msg_pop_heap_w_region (svm_region_t * vlib_rp, void *oldheap) +{ + svm_pop_heap (oldheap); + pthread_mutex_unlock (&vlib_rp->mutex); } void vl_msg_pop_heap (void *oldheap) { api_main_t *am = vlibapi_get_main (); - svm_pop_heap (oldheap); - pthread_mutex_unlock (&am->vlib_rp->mutex); + vl_msg_pop_heap_w_region (am->vlib_rp, oldheap); } int