api: Use vl_msg_push/pop_heap
Type: refactor
Change-Id: I0eb46676fc22ce6825b2d879498df344b5a855e8
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
diff --git a/src/vlibmemory/memory_shared.c b/src/vlibmemory/memory_shared.c
index 0b232ad..1716f27 100644
--- a/src/vlibmemory/memory_shared.c
+++ b/src/vlibmemory/memory_shared.c
@@ -163,15 +163,13 @@
*/
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 @@
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 @@
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 @@
#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