diff options
author | Nathan Skrzypczak <nathan.skrzypczak@gmail.com> | 2019-11-25 16:29:38 +0100 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2019-12-11 16:54:26 +0000 |
commit | 0aa4013e20471a7b23bc3252649c95c81b5d7519 (patch) | |
tree | 33fa625cc95b9feb23e512fc54a31152132e440d /src/vlibapi/api_shared.c | |
parent | cfdb109180cb01c17f92a465f925c244259ba06b (diff) |
api: Use vl_msg_push/pop_heap
Type: refactor
Change-Id: I0eb46676fc22ce6825b2d879498df344b5a855e8
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Diffstat (limited to 'src/vlibapi/api_shared.c')
-rw-r--r-- | src/vlibapi/api_shared.c | 20 |
1 files changed, 16 insertions, 4 deletions
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 @@ -1064,19 +1064,31 @@ vl_msg_api_get_msg_index (u8 * name_and_crc) } 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 |