summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/vlibmemory/memory_api.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/vlibmemory/memory_api.c b/src/vlibmemory/memory_api.c
index f229ecf48bd..4287bd36e5f 100644
--- a/src/vlibmemory/memory_api.c
+++ b/src/vlibmemory/memory_api.c
@@ -65,6 +65,7 @@ memclnt_queue_callback (vlib_main_t * vm)
{
int i;
api_main_t *am = vlibapi_get_main ();
+ int have_pending_rpcs;
if (PREDICT_FALSE (vec_len (vl_api_queue_cursizes) !=
1 + vec_len (am->vlib_private_rps)))
@@ -103,7 +104,12 @@ memclnt_queue_callback (vlib_main_t * vm)
break;
}
}
- if (vec_len (vm->pending_rpc_requests))
+
+ clib_spinlock_lock_if_init (&vm->pending_rpc_lock);
+ have_pending_rpcs = vec_len (vm->pending_rpc_requests) > 0;
+ clib_spinlock_unlock_if_init (&vm->pending_rpc_lock);
+
+ if (have_pending_rpcs)
{
vm->queue_signal_pending = 1;
vm->api_queue_nonempty = 1;