mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-17 22:50:38 +08:00
[mpp_list]: Add wait function
NOTE: The wait function MUST be used with lock protection. Change-Id: I14f48795d5833c9aedc311c56139775bf07f0e79 Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -299,6 +299,38 @@ RK_S32 mpp_list::flush()
|
||||
return 0;
|
||||
}
|
||||
|
||||
MPP_RET mpp_list::wait_lt(RK_S64 timeout, RK_S32 val)
|
||||
{
|
||||
if (list_size() <= val)
|
||||
return MPP_OK;
|
||||
|
||||
if (!timeout)
|
||||
return MPP_NOK;
|
||||
|
||||
if (timeout < 0)
|
||||
wait();
|
||||
else
|
||||
wait(timeout);
|
||||
|
||||
return list_size() <= val ? MPP_OK : MPP_NOK;
|
||||
}
|
||||
|
||||
MPP_RET mpp_list::wait_gt(RK_S64 timeout, RK_S32 val)
|
||||
{
|
||||
if (list_size() >= val)
|
||||
return MPP_OK;
|
||||
|
||||
if (!timeout)
|
||||
return MPP_NOK;
|
||||
|
||||
if (timeout < 0)
|
||||
wait();
|
||||
else
|
||||
wait(timeout);
|
||||
|
||||
return list_size() >= val ? MPP_OK : MPP_NOK;
|
||||
}
|
||||
|
||||
RK_U32 mpp_list::get_key()
|
||||
{
|
||||
return keys++;
|
||||
|
Reference in New Issue
Block a user