svm: queue sub: Add conditional timed wait
On reviece side svm queue only permits blocking and non-blocking calls. This patch adds timed wait blocking functionality which returns either on signal/event or on given time out. It also preserves the original behavior, so it will not hurt client applications which are using svm queue. Change-Id: Ic10632170330a80afb8bc781d4ccddfe4da2c69a Signed-off-by: Mohsin Kazmi <sykazmi@cisco.com>
This commit is contained in:

committed by
Dave Barach

parent
e82488f10f
commit
3fca567ff4
@ -245,7 +245,7 @@ public:
|
||||
*
|
||||
* @return VAPI_OK on success, other error code on error
|
||||
*/
|
||||
vapi_error_e dispatch (const Common_req *limit = nullptr)
|
||||
vapi_error_e dispatch (const Common_req *limit = nullptr, u32 time = 5)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock (dispatch_mutex);
|
||||
vapi_error_e rv = VAPI_OK;
|
||||
@ -254,7 +254,8 @@ public:
|
||||
{
|
||||
void *shm_data;
|
||||
size_t shm_data_size;
|
||||
rv = vapi_recv (vapi_ctx, &shm_data, &shm_data_size);
|
||||
rv = vapi_recv (vapi_ctx, &shm_data, &shm_data_size, SVM_Q_TIMEDWAIT,
|
||||
time);
|
||||
if (VAPI_OK != rv)
|
||||
{
|
||||
return rv;
|
||||
|
Reference in New Issue
Block a user