summaryrefslogtreecommitdiffstats
path: root/src/vlibmemory/memory_shared.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlibmemory/memory_shared.c')
-rw-r--r--src/vlibmemory/memory_shared.c15
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