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/vlibmemory/memory_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/vlibmemory/memory_shared.c')
-rw-r--r-- | src/vlibmemory/memory_shared.c | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/src/vlibmemory/memory_shared.c b/src/vlibmemory/memory_shared.c index 0b232adf899..1716f271466 100644 --- a/src/vlibmemory/memory_shared.c +++ b/src/vlibmemory/memory_shared.c @@ -163,15 +163,13 @@ vl_msg_api_alloc_internal (svm_region_t * vlib_rp, int nbytes, int pool, */ am->ring_misses++; - pthread_mutex_lock (&vlib_rp->mutex); - oldheap = svm_push_data_heap (vlib_rp); + oldheap = vl_msg_push_heap_w_region (vlib_rp); if (may_return_null) { rv = clib_mem_alloc_or_null (nbytes); if (PREDICT_FALSE (rv == 0)) { - svm_pop_heap (oldheap); - pthread_mutex_unlock (&vlib_rp->mutex); + vl_msg_pop_heap_w_region (vlib_rp, oldheap); return 0; } } @@ -180,8 +178,7 @@ vl_msg_api_alloc_internal (svm_region_t * vlib_rp, int nbytes, int pool, rv->q = 0; rv->gc_mark_timestamp = 0; - svm_pop_heap (oldheap); - pthread_mutex_unlock (&vlib_rp->mutex); + vl_msg_pop_heap_w_region (vlib_rp, oldheap); out: #if DEBUG_MESSAGE_BUFFER_OVERRUN > 0 @@ -296,8 +293,7 @@ vl_msg_api_free_w_region (svm_region_t * vlib_rp, void *a) return; } - pthread_mutex_lock (&vlib_rp->mutex); - oldheap = svm_push_data_heap (vlib_rp); + oldheap = vl_msg_push_heap_w_region (vlib_rp); #if DEBUG_MESSAGE_BUFFER_OVERRUN > 0 { @@ -308,8 +304,7 @@ vl_msg_api_free_w_region (svm_region_t * vlib_rp, void *a) #endif clib_mem_free (rv); - svm_pop_heap (oldheap); - pthread_mutex_unlock (&vlib_rp->mutex); + vl_msg_pop_heap_w_region (vlib_rp, oldheap); } void |