aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlibmemory/memory_client.c
diff options
context:
space:
mode:
authorNathan Skrzypczak <nathan.skrzypczak@gmail.com>2019-11-25 16:29:38 +0100
committerFlorin Coras <florin.coras@gmail.com>2019-12-11 16:54:26 +0000
commit0aa4013e20471a7b23bc3252649c95c81b5d7519 (patch)
tree33fa625cc95b9feb23e512fc54a31152132e440d /src/vlibmemory/memory_client.c
parentcfdb109180cb01c17f92a465f925c244259ba06b (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_client.c')
-rw-r--r--src/vlibmemory/memory_client.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/vlibmemory/memory_client.c b/src/vlibmemory/memory_client.c
index b5090636a7f..bd89526b696 100644
--- a/src/vlibmemory/memory_client.c
+++ b/src/vlibmemory/memory_client.c
@@ -160,7 +160,6 @@ void vl_msg_api_send_shmem (svm_queue_t * q, u8 * elem);
int
vl_client_connect (const char *name, int ctx_quota, int input_queue_size)
{
- svm_region_t *svm;
vl_api_memclnt_create_t *mp;
vl_api_memclnt_create_reply_t *rp;
svm_queue_t *vl_input_queue;
@@ -181,7 +180,6 @@ vl_client_connect (const char *name, int ctx_quota, int input_queue_size)
return -1;
}
- svm = am->vlib_rp;
shmem_hdr = am->shmem_hdr;
if (shmem_hdr == 0 || shmem_hdr->vl_input_queue == 0)
@@ -193,12 +191,10 @@ vl_client_connect (const char *name, int ctx_quota, int input_queue_size)
CLIB_MEM_UNPOISON (shmem_hdr, sizeof (*shmem_hdr));
VL_MSG_API_SVM_QUEUE_UNPOISON (shmem_hdr->vl_input_queue);
- pthread_mutex_lock (&svm->mutex);
- oldheap = svm_push_data_heap (svm);
+ oldheap = vl_msg_push_heap ();
vl_input_queue = svm_queue_alloc_and_init (input_queue_size, sizeof (uword),
getpid ());
- svm_pop_heap (oldheap);
- pthread_mutex_unlock (&svm->mutex);
+ vl_msg_pop_heap (oldheap);
am->my_client_index = ~0;
am->my_registration = 0;
@@ -256,11 +252,9 @@ vl_api_memclnt_delete_reply_t_handler (vl_api_memclnt_delete_reply_t * mp)
void *oldheap;
api_main_t *am = vlibapi_get_main ();
- pthread_mutex_lock (&am->vlib_rp->mutex);
- oldheap = svm_push_data_heap (am->vlib_rp);
+ oldheap = vl_msg_push_heap ();
svm_queue_free (am->vl_input_queue);
- pthread_mutex_unlock (&am->vlib_rp->mutex);
- svm_pop_heap (oldheap);
+ vl_msg_pop_heap (oldheap);
am->my_client_index = ~0;
am->my_registration = 0;